uka.karmi.rmi
Class Technology

java.lang.Object
  extended byuka.karmi.rmi.Technology
All Implemented Interfaces:
Constants
Direct Known Subclasses:
StreamTechnology

public abstract class Technology
extends java.lang.Object
implements Constants

Base class for technologies. Every technology has a domainId which is read from the properties file on startup. The transport calls the technology's init() method with a ConfigBundle. DomainId and dgc field are set by the init() method of the Technology class. The technology can also read technology specific values from this ConfigBundle.

The other methods are called from the reference layer when a client reference wants to invoke a method on the server.

The dgcCall and dgcAsyncCall methods are reserved for the dgc object connected with this technology.

Subclasses of Technology can overwrite buildUTID(). If this method is not overwritten the technology object can not be used to make initial registry lookups (getting remote objects by URL).

Author:
Christian Nester, Bernhard Haumacher

Field Summary
protected  ConfigBundle config
           
 DGC dgc
          A distributed garbage collector for this technology.
 int domainId
          A global number to distinguish different technology domains.
protected  java.util.Hashtable ep2utid
          Maps export points to UTID objects of this technology.
 java.lang.String protocol
          The protocol identifier used in URLs pointing to objects, which can be accessed by this technology.
protected  java.util.Hashtable utid2ep
          Maps UTID objects for this technology to their corresponding export points.
 
Fields inherited from interface uka.karmi.rmi.server.Constants
APP_CALL, COLLECTIVE_OPERATION, DGC_ACK, DGC_CALL, DGC_CALL_ASYNC, MID_BARRIER, MID_COLLECTIVE_EXCHANGE, MID_COLLECTIVE_UPDATE, MID_EXCLUSIVE_LOCK, MID_EXCLUSIVE_UPDATE, MID_REQUEST_TICKET, MID_REQUEST_WAIT, MID_RMA, MID_SERVICE_CREATE_REPLICA, MID_SERVICE_GET_STUB, MID_SERVICE_INTERRUPT, MID_SERVICE_MIGRATE, MID_SERVICE_UPDATE_REFERENCES, MID_WAKEUP, SERVICE_CALL, SKELETON_EXTENSION, STUB_EXTENSION
 
Constructor Summary
Technology()
           
 
Method Summary
 void asyncDgcCall(UTID utid, int methodId, java.lang.Object argument)
           
 UTID buildUTID(java.lang.String location)
          Creates a new UTID object from a string.
abstract  UTID buildUTID(java.lang.String host, int exportId)
           
 java.lang.Object dgcCall(UTID utid, int methodId, java.lang.Object argument)
          The DGC uses this method for communication.
abstract  ClientConnection getContext(byte cid, int mid, int oid, long tid, UTID useUtid)
          On the client side, the type of the connection class is determined by the remote object reference that decides about the best technology to use for a call.
 ClientConnection getContext(int mid, int oid, UTID useUtid)
          This method can not be moved to the Connection class as a factory method, because it serves as a frontend for the getContext(byte, int, int, long, UTID) method that is overriden in subclasses.
 ExportPoint getLocalExportPoint(UTID utid)
          This method returns the export point object if the given utid object addresses a local export point.
static java.lang.Object getMonitorFor(Remote server)
           
 UTID getUTID(ExportPoint ep)
          Returns a UTID object for this technology and the specified export point.
 void init(ConfigBundle config)
          This method is called after the standard constructor.
abstract  UTID initExportPoint(ExportPoint ep)
          Called after creation of a new export point.
 void probeConfig()
           
static java.lang.Object rmaAcquire(Remote server)
           
static void rmaRelease(java.lang.Object rma)
           
static SingleRemoteClientRef serviceCreateReplica(SingleRemoteClientRef that, PartitionedObjectSpace objects, java.lang.Object root, int rank)
           
static SingleRemoteClientRef serviceCreateReplicaBody(PartitionedObjectSpace objects, java.lang.Object root, int rank)
           
static RemoteStub serviceGetStub(SingleRemoteClientRef ref)
           
static boolean serviceInterrupt(ClientConnection clientConnection)
           
static RemoteClientRef serviceMigrate(Remote server, SingleRemoteClientRef to)
           
static void serviceUpdateReferences(SingleRemoteClientRef that, SingleRemoteClientRef[] refs)
           
static void serviceUpdateReferencesBody(ReplicatedServerRef that, SingleRemoteClientRef[] refs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

domainId

public int domainId
A global number to distinguish different technology domains. And to identify which technology objects can talk to each other (same domainId). It is not enough for two technologies to be objects of the same class. Two domains can be apart even if they use the same technology. The domainId is set by the transport before the init() method is called.


dgc

public DGC dgc
A distributed garbage collector for this technology. Do not make changes.


protocol

public java.lang.String protocol
The protocol identifier used in URLs pointing to objects, which can be accessed by this technology.


ep2utid

protected java.util.Hashtable ep2utid

Maps export points to UTID objects of this technology. This table is updated when a new ExportPoint is registered.

See Also:
getUTID(ExportPoint), getLocalExportPoint(UTID)

utid2ep

protected java.util.Hashtable utid2ep
Maps UTID objects for this technology to their corresponding export points. This table is updated when a new ExportPoint is registered.

See Also:
getUTID(ExportPoint), getLocalExportPoint(UTID)

config

protected ConfigBundle config
Constructor Detail

Technology

public Technology()
Method Detail

probeConfig

public void probeConfig()

init

public void init(ConfigBundle config)
          throws java.lang.Exception
This method is called after the standard constructor. Some init properties are standard and some are technology dependent. The values are read from the config file.

Subclasses of Technology which overwrite this method must also call this method ( super.init(config) ).

Throws:
java.lang.Exception

initExportPoint

public abstract UTID initExportPoint(ExportPoint ep)
                              throws java.lang.Exception
Called after creation of a new export point.

Parameters:
ep - export point
Returns:
new UTID object or null if export to ep is not supported.
Throws:
java.lang.Exception

getUTID

public UTID getUTID(ExportPoint ep)
Returns a UTID object for this technology and the specified export point. The returned UTID object does not have to be new. The caller of this method is not allowed to change the returned object.

Parameters:
ep - export point
Returns:
UTID object or null if export to ep is not supported.

getLocalExportPoint

public ExportPoint getLocalExportPoint(UTID utid)
This method returns the export point object if the given utid object addresses a local export point. Otherwise it returns null.

Parameters:
utid - UTID address of the export point
Returns:
local export point object or null if UTID object doesn't address a local export point.

buildUTID

public final UTID buildUTID(java.lang.String location)
                     throws RemoteException
Creates a new UTID object from a string.

KaRMI uses the local configuration information from the configuration file to map the abstract export point to a port number. This means that the configuration information of all hosts must be equal because KaRMI does not look up the configuration of the remote host.

Parameters:
location - has the syntax "host-identifier:export-point". The host identifier is technology specific.
Throws:
RemoteException

buildUTID

public abstract UTID buildUTID(java.lang.String host,
                               int exportId)
                        throws java.lang.Exception
Throws:
java.lang.Exception

getContext

public final ClientConnection getContext(int mid,
                                         int oid,
                                         UTID useUtid)
                                  throws RemoteException
This method can not be moved to the Connection class as a factory method, because it serves as a frontend for the getContext(byte, int, int, long, UTID) method that is overriden in subclasses.

Throws:
RemoteException
See Also:
getContext(byte cid, int mid, int oid, long tid, UTID useUtid)

getContext

public abstract ClientConnection getContext(byte cid,
                                            int mid,
                                            int oid,
                                            long tid,
                                            UTID useUtid)
                                     throws RemoteException
On the client side, the type of the connection class is determined by the remote object reference that decides about the best technology to use for a call. The getContext() method then creates a connection of the corresponding type and implicitly sets cid, oid, mid and tid as context for the outgoing call. This method can not be moved to the Connection class as a factory method, because it is overridden in subclasses of the technology to create the corresponding connection classes suitable for that technology.

Throws:
RemoteException
See Also:
Connection#setContext(byte cid, int oid, int mid, long tid)

serviceInterrupt

public static boolean serviceInterrupt(ClientConnection clientConnection)
                                throws RemoteException
Throws:
RemoteException

serviceMigrate

public static RemoteClientRef serviceMigrate(Remote server,
                                             SingleRemoteClientRef to)
                                      throws RemoteException
Throws:
RemoteException

serviceGetStub

public static RemoteStub serviceGetStub(SingleRemoteClientRef ref)
                                 throws RemoteException
Throws:
RemoteException

serviceCreateReplica

public static SingleRemoteClientRef serviceCreateReplica(SingleRemoteClientRef that,
                                                         PartitionedObjectSpace objects,
                                                         java.lang.Object root,
                                                         int rank)
                                                  throws RemoteException
Throws:
RemoteException

serviceCreateReplicaBody

public static SingleRemoteClientRef serviceCreateReplicaBody(PartitionedObjectSpace objects,
                                                             java.lang.Object root,
                                                             int rank)
                                                      throws RemoteException
Throws:
RemoteException

serviceUpdateReferences

public static void serviceUpdateReferences(SingleRemoteClientRef that,
                                           SingleRemoteClientRef[] refs)
                                    throws RemoteException
Throws:
RemoteException

serviceUpdateReferencesBody

public static void serviceUpdateReferencesBody(ReplicatedServerRef that,
                                               SingleRemoteClientRef[] refs)
                                        throws RemoteException
Throws:
RemoteException

getMonitorFor

public static java.lang.Object getMonitorFor(Remote server)

rmaAcquire

public static java.lang.Object rmaAcquire(Remote server)
                                   throws RemoteException
Throws:
RemoteException

rmaRelease

public static void rmaRelease(java.lang.Object rma)
                       throws RemoteException
Throws:
RemoteException

dgcCall

public java.lang.Object dgcCall(UTID utid,
                                int methodId,
                                java.lang.Object argument)
                         throws java.lang.Throwable
The DGC uses this method for communication. The invocation of this method on the local technology will result in the invocation of the doDGCCall() method on the DGC object for the remote technology represented by the utid identifier. The methodId and argument are passed to the method of the remote DGC implementation.

Throws:
java.lang.Throwable
See Also:
DGC.doDGCCall(ExportPoint, int, Object)

asyncDgcCall

public void asyncDgcCall(UTID utid,
                         int methodId,
                         java.lang.Object argument)
                  throws java.lang.Throwable
Throws:
java.lang.Throwable
See Also:
dgcCall(UTID, int, Object)