|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectmandala.rami.AbstractFutureClient
Abstract implementation of the FutureClient interface.
FutureClient| Field Summary | |
protected AsynchronousReference |
ar
|
protected Object[] |
args
|
Callback |
callback
|
protected ThreadOp |
caller
|
protected Cancelable |
cancelable
|
protected MethodOp |
method
|
| Constructor Summary | |
protected |
AbstractFutureClient(AsynchronousReference ar,
MethodOp method,
Object[] args,
ThreadOp caller,
Callback callback)
|
| Method Summary | |
boolean |
cancel()
Cancel the operation related to this cancelable object. |
Object[] |
getArgs()
Returns the argument of the method involved in an asynchronous method invocation. |
AsynchronousReference |
getAsynchronousReference()
Returns the AsynchronousReference involved in an
asynchronous method invocation. |
Callback |
getCallback()
Returns the Callback instance to use when the method
invocation is considered terminated. |
ThreadOp |
getCallerThread()
Get the thread which has been registered has interested in this object. |
MethodOp |
getMethod()
Returns the MethodOp involved in an asynchronous method
invocation. |
Object |
getReturnedResult()
Return the result returned by the call to an asynchronous method invocation. |
boolean |
interrupt()
Interrupt the operation related to this cancelable object. |
boolean |
isStarted()
Returns true if the asynchronous method invocation is
started. |
String |
toString()
|
ThreadOp |
waitForCalleeThread()
Wait for the thread which is running the method invocation (the "callee") to be set. |
ThreadOp |
waitForCalleeThread(long timeout)
Wait for the thread which is running the method invocation (the "callee") to be set for a specified amount of time. |
Object |
waitForResult()
Equivalent to waitForResult(Long.MAX_VALUE). |
Object |
waitForResult(long timeout)
Wait for the availability of the result of an asynchronous method invocation for a specified amount of time. |
void |
waitUntilCalleeAvailable()
Wait until the callee thread become available. |
void |
waitUntilResultAvailable()
Wait until the result become available. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface mandala.rami.InvocationObserver |
getCalleeThread, isCalleeAvailable, isResultAvailable |
| Methods inherited from interface mandala.rami.MethodResult |
exceptionOccured, getException, getReturnedResultTrusted |
| Methods inherited from interface mandala.rami.InvocationEventsWaiter |
waitUntilCalleeAvailable, waitUntilResultAvailable |
| Field Detail |
protected final AsynchronousReference ar
protected final MethodOp method
protected final Object[] args
protected final ThreadOp caller
public final Callback callback
protected Cancelable cancelable
| Constructor Detail |
protected AbstractFutureClient(AsynchronousReference ar,
MethodOp method,
Object[] args,
ThreadOp caller,
Callback callback)
| Method Detail |
public AsynchronousReference getAsynchronousReference()
InvocationInfoReturns the AsynchronousReference involved in an
asynchronous method invocation. This method is safe
related
The value returned is the asynchronous reference on which the
reflective asynchronous invocation of the method returned by
getMethod has been performed.
getAsynchronousReference in interface InvocationInfoAsynchronousReference valuepublic MethodOp getMethod()
InvocationInfoReturns the MethodOp involved in an asynchronous method
invocation. This method is safe related
getMethod in interface InvocationInfoMethodOp involved in an asynchronous method
invocationMethodOppublic Object[] getArgs()
InvocationInfoReturns the argument of the method involved in an asynchronous method invocation. This method is safe related
getArgs in interface InvocationInfopublic Callback getCallback()
InvocationInfoReturns the Callback instance to use when the method
invocation is considered terminated. This method is safe
related
getCallback in interface InvocationInfoCallback valueCallbackpublic ThreadOp getCallerThread()
InvocationInfoGet the thread which has been registered has interested in this object. This method is safe related.
Implementation may return null if the information has
not been set (maybe for efficiency reasons).
getCallerThread in interface InvocationInfoThreadOp valuepublic boolean isStarted()
InvocationObserverReturns true if the asynchronous method invocation is
started. This method is safe related
If this method returns false, then the asynchronous
method invocation has not start its execution. Otherwise, the method may
be currently running or terminated.
isStarted in interface InvocationObservertrue if this method has started its execution,
false otherwise.
public Object getReturnedResult()
throws Throwable
MethodResultReturn the result returned by the call to an asynchronous method
invocation. If doesExceptionOccured() returns
true, the exception caught is thrown. This method is
unsafe related.
getReturnedResult in interface MethodResultThrowable - The exception thrown during the call.
public Object waitForResult(long timeout)
throws Throwable,
TimedOutException,
InterruptedException
InvocationEventsWaiterWait for the availability of the result of an asynchronous method invocation for a specified amount of time. This method is safe related.
If an exception occured during the call, it is thrown.
If the specified timeout expires, a
TimedOutException is thrown.
waitForResult in interface InvocationEventsWaiterThrowable - The exception thrown by the asynchronous method
invocation.
InterruptedException - if another thread has interrupted the
current thread. The interrupted status of the current thread is cleared
when this exception is thrown.
TimedOutException - if the specified timeout
expires.
public Object waitForResult()
throws Throwable,
InterruptedException
InvocationEventsWaiterEquivalent to waitForResult(Long.MAX_VALUE). This method is
safe related.
waitForResult in interface InvocationEventsWaiterThrowable - the exception thrown by the asynchronous method
invocation.
InterruptedException - if the thread has been interrupted
public void waitUntilResultAvailable()
throws InterruptedException
InvocationEventsWaiterWait until the result become available. This method is safe related.
waitUntilResultAvailable in interface InvocationEventsWaiterInterruptedException
public ThreadOp waitForCalleeThread(long timeout)
throws TimedOutException,
InterruptedException
InvocationEventsWaiterWait for the thread which is running the method invocation (the "callee") to be set for a specified amount of time. This method is safe related.
If the callee has not yet been set, wait timeout before
returning the result.
waitForCalleeThread in interface InvocationEventsWaitertimeout - the maximum time to wait in milliseconds (0 means wait
for ever).
InterruptedException - if another thread has interrupted the
current thread. The interrupted status of the current thread is cleared
when this exception is thrown.
TimedOutException
public ThreadOp waitForCalleeThread()
throws InterruptedException
InvocationEventsWaiterWait for the thread which is running the method invocation (the "callee") to be set. This method is safe related.
waitForCalleeThread in interface InvocationEventsWaiterInterruptedException - if another thread has interrupted the
current thread. The interrupted status of the current thread is cleared
when this exception is thrown.
public void waitUntilCalleeAvailable()
throws InterruptedException
InvocationEventsWaiterWait until the callee thread become available. This method is safe related.
waitUntilCalleeAvailable in interface InvocationEventsWaiterInterruptedExceptionpublic boolean cancel()
CancelableCancel the operation related to this cancelable object.
This method does nothing if the related operation is already started or terminated.
This method returns true if the related operation has
been succesfully cancelled, false otherwise.
cancel in interface Cancelabletrue if the related operation has been succesfully
cancelled, false otherwisepublic boolean interrupt()
CancelableInterrupt the operation related to this cancelable object.
Interruption of an operation means that the thread which is running
the related operation is interrupted. It is the responsibilty of the
operation to check the interrupt status of the current thread (see
Thread.interrupted() in order to be able to return as
soon as possible on interruption.
This method does nothing if the related operation is not started yet or if it is already terminated.
This method returns true if the related operation has
been succesfully interrupted, false otherwise.
interrupt in interface Cancelabletrue if the related operation has been succesfully
interrupted, false otherwise.public String toString()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||