uka.karmi.stream
Class StreamTechnology

java.lang.Object
  extended byuka.karmi.rmi.Technology
      extended byuka.karmi.stream.StreamTechnology
All Implemented Interfaces:
Constants
Direct Known Subclasses:
GMTechnology, PSPTechnology, SocketTechnology

public abstract class StreamTechnology
extends Technology
implements Constants

The socket technology opens connections for remote calls and caches these connections. Connections which have not been used for some time are closed.

The socket technology does not support a method counter. It does not implement the true unexport() semantics. This implementation is currently limited to communication with a maximum of 50 hosts.

Supported properties:

timeout: unused connections are closed after "timeout" ms. The default is 5000.

Export point configuration:

karmi.technology.NUMBER.EXPORTPOINTNAME.port = portnumber e.g. : karmi.technology.1.registry.port = 1099 The wire format of void foo(byte[] b) - call -- header byte cid int oid int mid -- parameter --- descriptor byte TC_ARRAY byte TC_REFERENCE int handle --- object int length byte[length] data = 19 + length bytes - result byte code = 1 byte + length of result value

Author:
Bernhard Haumacher

Nested Class Summary
static interface StreamTechnology.CallBack
           
protected  class StreamTechnology.LocalID
          A LocalID references a remote technology.
 
Field Summary
private static int BUFFERSIZE
           
protected  int CONNECTION_TIMEOUT
           
(package private)  java.util.HashMap exportPointInfo
           
(package private)  EnlargingArray localIDArray
           
(package private)  java.util.HashMap localIDMap
          {UTID -> LocalID}: hashtable that maps UTID objects for remote technologies to their local identifiers.
(package private)  IDPool localIDPool
          Pool of local identifiers for remote technologies.
 
Fields inherited from class uka.karmi.rmi.Technology
config, dgc, domainId, ep2utid, protocol, utid2ep
 
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
StreamTechnology()
           
 
Method Summary
 void collectConnections()
          Entry method for the collection process of unused connections.
abstract  StreamClientConnection createConnection(UTID utid, StreamTechnology.CallBack cb)
          Create a new connection to the remote technology referenced by utid.
 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.
private  StreamTechnology.LocalID getLocalID(UTID utid)
          Access is synchronized in the context.
 void init(ConfigBundle config)
          This method is called after the standard constructor.
 void probeConfig()
           
 
Methods inherited from class uka.karmi.rmi.Technology
asyncDgcCall, buildUTID, buildUTID, dgcCall, getContext, getLocalExportPoint, getMonitorFor, getUTID, initExportPoint, rmaAcquire, rmaRelease, serviceCreateReplica, serviceCreateReplicaBody, serviceGetStub, serviceInterrupt, serviceMigrate, serviceUpdateReferences, serviceUpdateReferencesBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUFFERSIZE

private static final int BUFFERSIZE
See Also:
Constant Field Values

CONNECTION_TIMEOUT

protected int CONNECTION_TIMEOUT

exportPointInfo

java.util.HashMap exportPointInfo

localIDPool

IDPool localIDPool
Pool of local identifiers for remote technologies.


localIDMap

java.util.HashMap localIDMap
{UTID -> LocalID}: hashtable that maps UTID objects for remote technologies to their local identifiers. These local identifiers are used as indexes to the array of unused connections.


localIDArray

EnlargingArray localIDArray
Constructor Detail

StreamTechnology

public StreamTechnology()
                 throws java.io.IOException
Method Detail

getContext

public ClientConnection getContext(byte cid,
                                   int mid,
                                   int oid,
                                   long tid,
                                   UTID useUtid)
                            throws RemoteException
Description copied from class: Technology
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.

Specified by:
getContext in class Technology
Throws:
RemoteException
See Also:
Connection#setContext(byte cid, int oid, int mid, long tid)

createConnection

public abstract StreamClientConnection createConnection(UTID utid,
                                                        StreamTechnology.CallBack cb)
                                                 throws java.io.IOException
Create a new connection to the remote technology referenced by utid. The returned connection is a specialized subclass of StreamConnection for use with the concrete transport technology.

Throws:
java.io.IOException

getLocalID

private StreamTechnology.LocalID getLocalID(UTID utid)
Access is synchronized in the context.


collectConnections

public void collectConnections()
Entry method for the collection process of unused connections. Open connections to all remote technologies are scanned and closed, if they are not used for a certain timeout.


init

public void init(ConfigBundle config)
          throws java.lang.Exception
Description copied from class: Technology
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) ).

Overrides:
init in class Technology
Throws:
java.lang.Exception

probeConfig

public void probeConfig()
Overrides:
probeConfig in class Technology