uka.karmi.stream
Class StreamServerConnection

java.lang.Object
  extended byuka.transport.JdkMarshalContext
      extended byuka.karmi.rmi.Connection
          extended byuka.karmi.rmi.ServerConnection
              extended byuka.karmi.stream.StreamServerConnection
All Implemented Interfaces:
CallHandler.BlockingOperation, CallHandler.CallbackOperation, Constants, RMACallback

public class StreamServerConnection
extends ServerConnection
implements Constants

Base class for all server-side connections in stream-based technologies. A StreamServerConnection encapsulates an input and an output stream for marshaling and unmarshaling method arguments and results.

A connection is used on the server side by the server thread and the skeleton to unmarshal the method arguments and return the result to the caller.

Author:
Bernhard Haumacher
See Also:
ExecutionThread, RemoteSkeleton

Field Summary
private  long _tid
          Keeps the previous thread ID of the thread dispatching this connection.
private  DGCMarshalContext marshalContext
           
private  DGCUnmarshalContext unmarshalContext
           
 
Fields inherited from class uka.karmi.rmi.ServerConnection
ep, handlers, technology, useTID
 
Fields inherited from class uka.karmi.rmi.Connection
cid, mid, oid, RETURN_EXCEPTION, RETURN_INTERNAL, RETURN_INTERRUPT, RETURN_OK, tid
 
Fields inherited from class uka.transport.JdkMarshalContext
 
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
StreamServerConnection(MarshalOutputStream snd, MarshalInputStream rcv, ExportPoint ep, Technology technology)
           
 
Method Summary
 void closeAsynchronousCall()
           
 void closeReceiveCall()
          Indicates that the call was received successfully.
 void closeReceiveDgcCall()
           
 void closeSendDgcResult()
           
 void closeSendResult()
          Connection cleanup.
 void openReceiveCall()
          Receive connection parameters Connection.cid, Connection.oid, Connection.mid, and Connection.tid.
 void openSendResult(byte code)
           
 
Methods inherited from class uka.karmi.rmi.ServerConnection
dispatch, dispatchInterrupt, doAsyncDGCCall, doBlocking, doCallback, doDGCCall, doSynchronized, getBlockingProblem, getCallbackProblem, getHandler, getRemoteServerRef, getThreadID, openSendResult, releaseHandler, toStringMembers
 
Methods inherited from class uka.karmi.rmi.Connection
toString
 
Methods inherited from class uka.transport.JdkMarshalContext
areObjectsReceived, areObjectsSent, close, closeReceivePrimitive, closeSendPrimitive, flush, getMarshalStream, getUnmarshalStream, openReceivePrimitive, openSendPrimitive, receiveBoolean, receiveByte, receiveChar, receiveDouble, receiveFloat, receiveInt, receiveLong, receiveObject, receiveSingleBoolean, receiveSingleByte, receiveSingleChar, receiveSingleDouble, receiveSingleFloat, receiveSingleInt, receiveSingleLong, resetReceive, resetSend, sendBoolean, sendByte, sendChar, sendDouble, sendFloat, sendInt, sendLong, sendObject, sendSingleBoolean, sendSingleByte, sendSingleChar, sendSingleDouble, sendSingleFloat, sendSingleInt, sendSingleLong
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

unmarshalContext

private DGCUnmarshalContext unmarshalContext

marshalContext

private DGCMarshalContext marshalContext

_tid

private long _tid
Keeps the previous thread ID of the thread dispatching this connection. During the dispatch of a remote method call, the dispatching thread adopts the thread ID transmitted with the call. After the call is finished, the thread ID of the thread must be restored to its original value. The thread ID can not simply be cleared after the call, because the dispatching thread may be an application thread that dispatches a callback invocation. See BUG/141.

Constructor Detail

StreamServerConnection

public StreamServerConnection(MarshalOutputStream snd,
                              MarshalInputStream rcv,
                              ExportPoint ep,
                              Technology technology)
Method Detail

openReceiveCall

public void openReceiveCall()
                     throws java.io.IOException
Description copied from class: ServerConnection
Receive connection parameters Connection.cid, Connection.oid, Connection.mid, and Connection.tid.

Specified by:
openReceiveCall in class ServerConnection
Throws:
java.io.IOException

closeReceiveCall

public void closeReceiveCall()
                      throws java.io.IOException
Description copied from class: ServerConnection

Indicates that the call was received successfully. This method is called by the skeleton just before invoking the server method.

At the time, this method is called the following has happened: The skeleton has already unmarshaled the arguments form this connection in its doApplicationCall() method.

This method belongs to the server-side skeleton interface of the connection.

Specified by:
closeReceiveCall in class ServerConnection
Throws:
java.io.IOException
See Also:
RemoteSkeleton.doApplicationCall(ServerConnection)

closeReceiveDgcCall

public void closeReceiveDgcCall()
                         throws java.io.IOException
Specified by:
closeReceiveDgcCall in class ServerConnection
Throws:
java.io.IOException
See Also:
ServerConnection.closeReceiveCall()

openSendResult

public void openSendResult(byte code)
                    throws java.io.IOException
Specified by:
openSendResult in class ServerConnection
Parameters:
code - Legal values are: RETURN_OK, RETURN_EXCEPTION, RETURN_OK | RETURN_INTERRUPT, RETURN_EXCEPTION | RETURN_INTERRUPT, RETURN_INTERNAL
Throws:
java.io.IOException
See Also:
Connection.RETURN_OK, Connection.RETURN_EXCEPTION, Connection.RETURN_INTERRUPT, Connection.RETURN_INTERNAL

closeAsynchronousCall

public void closeAsynchronousCall()
                           throws RemoteException
Specified by:
closeAsynchronousCall in class Connection
Throws:
RemoteException

closeSendResult

public void closeSendResult()
                     throws java.io.IOException
Description copied from class: ServerConnection

Connection cleanup. After this method completes, the next remote call can be unmarshaled from this connection object. This method is invoked after a remote method invocation has been completed and the result is marshaled back to the caller.

This method belongs to the server-side skeleton interface of the connection.

Overrides:
closeSendResult in class ServerConnection
Throws:
java.io.IOException
See Also:
ServerConnection.dispatch(boolean)

closeSendDgcResult

public void closeSendDgcResult()
                        throws java.io.IOException
Overrides:
closeSendDgcResult in class ServerConnection
Throws:
java.io.IOException
See Also:
ServerConnection.closeSendResult()