uka.karmi.rmi.server
Class UnicastRemoteObject

java.lang.Object
  extended byuka.karmi.rmi.server.RemoteObject
      extended byuka.karmi.rmi.server.UnicastRemoteObject
All Implemented Interfaces:
java.lang.Cloneable, PatchableRoot, Remote

public class UnicastRemoteObject
extends RemoteObject
implements java.lang.Cloneable

A remote object that has exactly one server implementation object. An application class can be turned into a remotely accessible one by implementing a custom remote interface that extends uka.karmi.rmi.Remote and extending UnicastRemoteObject. UnicastRemoteObjects are exported in their constructor. It is sufficient for an application class to implement a custom remote interface and export their objects manually, but sub-classes of UnicastRemoteObject are slightly faster.

Author:
Christian Nester, Bernhard Haumacher
See Also:
Remote, exportObject(Remote)

Field Summary
 
Fields inherited from class uka.karmi.rmi.server.RemoteObject
serverRef
 
Constructor Summary
UnicastRemoteObject()
          Exports object on the default export point.
UnicastRemoteObject(int exportId)
          Exports object on the specified export point.
 
Method Summary
static RemoteStub buildStub(java.lang.String className, java.lang.String location, int objectId)
          Creates a stub for a given class at a given location.
 java.lang.Object clone()
           
static RemoteStub exportObject(Remote obj)
          Exports an object that does not extend UnicastRemoteObject, or an UnicastRemoteObject that was previously un-exported.
static RemoteStub exportObject(Remote obj, int exportId)
          Exports an object that does not extend UnicastRemoteObject, or an UnicastRemoteObject that was previously un-exported.
static RemoteStub exportObject(Remote obj, int exportId, int objectId)
          Exports an object that does not extend UnicastRemoteObject, or an UnicastRemoteObject that was previously un-exported.
static boolean unexportObject(Remote obj, boolean force)
          Un-exports an exported remote object.
 
Methods inherited from class uka.karmi.rmi.server.RemoteObject
buildStub, equals, getOwner, hashCode, toString, toStringMembers, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UnicastRemoteObject

public UnicastRemoteObject()
                    throws RemoteException
Exports object on the default export point.

See Also:
ExportPoint.EXPORTID_DEFAULT

UnicastRemoteObject

public UnicastRemoteObject(int exportId)
                    throws RemoteException
Exports object on the specified export point. Under an anonymous object ID.

See Also:
ExportPoint.OBJECTID_ANONYMOUS
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Throws:
java.lang.CloneNotSupportedException

exportObject

public static RemoteStub exportObject(Remote obj)
                               throws RemoteException

Exports an object that does not extend UnicastRemoteObject, or an UnicastRemoteObject that was previously un-exported.

The object is exported at the default export point

Parameters:
obj - the object to be exported.
Throws:
RemoteException
See Also:
ExportPoint.EXPORTID_DEFAULT, exportObject(Remote, int), unexportObject(Remote, boolean)

exportObject

public static RemoteStub exportObject(Remote obj,
                                      int exportId)
                               throws RemoteException

Exports an object that does not extend UnicastRemoteObject, or an UnicastRemoteObject that was previously un-exported.

The object is exported at the specified export point with an anonymous object ID.

Parameters:
obj - the object to be exported.
Throws:
RemoteException
See Also:
ExportPoint.OBJECTID_ANONYMOUS, exportObject(Remote, int, int), unexportObject(Remote, boolean)

exportObject

public static RemoteStub exportObject(Remote obj,
                                      int exportId,
                                      int objectId)
                               throws RemoteException

Exports an object that does not extend UnicastRemoteObject, or an UnicastRemoteObject that was previously un-exported.

The object is exported at the specified export point under the specified well-known object ID.

Parameters:
obj - the object to be exported.
exportId - the export point the object should be exported at.
objectId - the well-known object ID for the object.
Throws:
RemoteException
See Also:
ExportPoint.OBJECTID_WELLKNOWN, unexportObject(Remote, boolean)

unexportObject

public static boolean unexportObject(Remote obj,
                                     boolean force)
                              throws NoSuchObjectException
Un-exports an exported remote object.

Parameters:
obj - the object to un-export
force - if true, un-export the object even if remote references still exist to the object.
Throws:
NoSuchObjectException

buildStub

public static RemoteStub buildStub(java.lang.String className,
                                   java.lang.String location,
                                   int objectId)
                            throws RemoteException
Creates a stub for a given class at a given location. The timing information and a second object identifier Id are not used. This method should only be used for permanent objects. The resulting references are not part of any DGC algorithms.

Throws:
RemoteException