|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuka.karmi.rmi.CallHandler
A call handler manages the control flow at the client-side of a remote method invocation.
| Nested Class Summary | |
static interface |
CallHandler.BlockingOperation
|
static interface |
CallHandler.CallbackOperation
|
| Field Summary | |
protected CallHandler.BlockingOperation |
blockingOperation
The blocking operation, which is delegated to the handler thread. |
static int |
CALLBACK
This value in state signals a callback remote method
invocation from another server thread. |
protected CallHandler.CallbackOperation |
callbackOperation
The current callback that is processed while the blockingOperation waits for completion. |
protected static Long2ObjectHashtable |
callHandlers
|
static int |
COMPLETED
This value in state signals the completion of the
blockingOperation delivered in handleCall(uka.karmi.rmi.CallHandler.BlockingOperation). |
static int |
IDLE
This call handler is currently unused, or the requesting thread is still waiting for a signal. |
protected boolean |
interrupted
Flag to keep track of interrupts received at the client-side. |
private boolean |
isTail
Tracks the registration state of this call handler. |
protected CallHandler |
parent
The parent call handler. |
java.lang.Thread |
receiveThread
The thread that is currently responsible for receiving the method call return code. |
protected int |
state
The internal state of this call handler. |
private boolean |
stopped
|
| Constructor Summary | |
CallHandler()
Constructs a new client-side connection handler. |
|
| Method Summary | |
void |
awaitCompletion()
|
protected void |
callback(CallHandler.CallbackOperation callbackOperation)
Announces a callback remote method invocation. |
static void |
dispatch(CallHandler.CallbackOperation callbackOperation)
Main entry point for the remote method dispatch (for application methods) on the server-side. |
static int |
getRemoteRecursionDepth()
|
void |
handleCall(CallHandler.BlockingOperation blockingOperation)
Main entry-point for a client thread that has sent a remote method invocation and is now waiting for the result code (represented as CallHandler.BlockingOperation). |
boolean |
isInterrupted()
|
private void |
processCallbacks(CallHandler.BlockingOperation blockingOperation)
|
void |
register(long tid)
Registers a handler for a given thread ID. |
void |
run()
The main loop of the thread responsible for receiving the result code from the remote method invocation. |
void |
stop()
|
java.lang.String |
toString()
|
java.lang.String |
toStringMembers()
|
static java.lang.String |
toStringState(int state)
|
void |
unregister(long tid)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int IDLE
CALLBACK, or COMPLETED. The CALLBACK signal
is assiciated with a callbackOperation.
state,
CALLBACK,
callbackOperation,
COMPLETED,
Constant Field Valuespublic static final int CALLBACK
state signals a callback remote method
invocation from another server thread. The callback associated
with this signal is stored in callbackOperation.
state,
callbackOperation,
Constant Field Valuespublic static final int COMPLETED
state signals the completion of the
blockingOperation delivered in handleCall(uka.karmi.rmi.CallHandler.BlockingOperation).
state,
Constant Field Valuesprotected int state
IDLE,
CALLBACK,
COMPLETEDprotected CallHandler parent
The parent call handler. All call handlers for remote method
invocations that belong to the same thread ID are linked
together through the parent reference. The remote
invocation represented by this call handler occurred within a
callback remote invocation to an earlier remote method
invocation represented by the parent call
handler.
The call handler at the head of the parent list
represents the most recent segment of the distributed
thread.
private boolean isTail
unregistered. This flag was introduced to
detect illegal call handler registration/unregistration
sequences described in BUG/I0189.
protected static Long2ObjectHashtable callHandlers
protected boolean interrupted
Flag to keep track of interrupts received at the client-side. Since interrupts are forwarded out-of-order to the server-side, the interrupt may be lost, if the remote method returns, before the interrupt signal has reached the server-side. If that happens, the interrupt is handled like a deferred interrupt returned from the server-side.
If this flag is set when handleCall(uka.karmi.rmi.CallHandler.BlockingOperation) returns, the
server did not get the interrupt that was sent out-of-order to
the remote machine. Now, the current thread is the head of the
distributed thread, but the interrupt can not be re-thrown
here:
Connection.RETURN_INTERRUPTprotected CallHandler.CallbackOperation callbackOperation
blockingOperation waits for completion. A callback is
announced by setting this value. The completion of the
announced callback is signaled by changing this value either to
null or any other callback object.
callback(CallHandler.CallbackOperation)protected CallHandler.BlockingOperation blockingOperation
null.
handleCall(uka.karmi.rmi.CallHandler.BlockingOperation)public java.lang.Thread receiveThread
run() method.
private boolean stopped
| Constructor Detail |
public CallHandler()
| Method Detail |
public static int getRemoteRecursionDepth()
public static void dispatch(CallHandler.CallbackOperation callbackOperation)
throws java.lang.Throwable
java.lang.ThrowableStreamServer.service(uka.karmi.stream.StreamServerConnection)public void register(long tid)
Registers a handler for a given thread ID. If a remote callback is received, it is redirected to the this handler. The registration should happen during openSendCall(). Registering during closeSendCall() is to late, because the call could already be on the way and the callback could be received before the registration of the handler is completed.
If another handler is already registered for the given thread ID, it is replaced by this handler. The parent handler is stored at this handler and re-registered at the time this handler is unregistered.
unregister(long)public void unregister(long tid)
register(long)public boolean isInterrupted()
interrupted
protected void callback(CallHandler.CallbackOperation callbackOperation)
throws java.lang.Throwable
handleCall(uka.karmi.rmi.CallHandler.BlockingOperation) for the completion of
the registered blockingOperation. This method blocks
until the callback invocation has completed.
java.lang.ThrowablehandleCall(uka.karmi.rmi.CallHandler.BlockingOperation)public void stop()
public void run()
run in interface java.lang.Runnable
public void awaitCompletion()
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void handleCall(CallHandler.BlockingOperation blockingOperation)
Main entry-point for a client thread that has sent a remote
method invocation and is now waiting for the result code
(represented as CallHandler.BlockingOperation).
This method handles incoming callback method invocations
(represented as CallHandler.CallbackOperation and interrupts sent
to the waiting thread. Callback invocations are executed in the
thread that called this method, interrupts are forwarded
out-of-order to the server-side.
callback(CallHandler.CallbackOperation),
run(),
ClientConnection.openReceiveResult()private void processCallbacks(CallHandler.BlockingOperation blockingOperation)
public java.lang.String toString()
public java.lang.String toStringMembers()
public static java.lang.String toStringState(int state)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||