|
|||||||||||
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()
InvocationInfo
Returns 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 InvocationInfo
AsynchronousReference
valuepublic MethodOp getMethod()
InvocationInfo
Returns the MethodOp
involved in an asynchronous method
invocation. This method is safe related
getMethod
in interface InvocationInfo
MethodOp
involved in an asynchronous method
invocationMethodOp
public Object[] getArgs()
InvocationInfo
Returns the argument of the method involved in an asynchronous method invocation. This method is safe related
getArgs
in interface InvocationInfo
public Callback getCallback()
InvocationInfo
Returns the Callback
instance to use when the method
invocation is considered terminated. This method is safe
related
getCallback
in interface InvocationInfo
Callback
valueCallback
public ThreadOp getCallerThread()
InvocationInfo
Get 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 InvocationInfo
ThreadOp
valuepublic boolean isStarted()
InvocationObserver
Returns 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 InvocationObserver
true
if this method has started its execution,
false
otherwise.public Object getReturnedResult() throws Throwable
MethodResult
Return 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 MethodResult
Throwable
- The exception thrown during the call.public Object waitForResult(long timeout) throws Throwable, TimedOutException, InterruptedException
InvocationEventsWaiter
Wait 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 InvocationEventsWaiter
Throwable
- 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
InvocationEventsWaiter
Equivalent to waitForResult(Long.MAX_VALUE). This method is
safe related.
waitForResult
in interface InvocationEventsWaiter
Throwable
- the exception thrown by the asynchronous method
invocation.
InterruptedException
- if the thread has been interruptedpublic void waitUntilResultAvailable() throws InterruptedException
InvocationEventsWaiter
Wait until the result become available. This method is safe related.
waitUntilResultAvailable
in interface InvocationEventsWaiter
InterruptedException
public ThreadOp waitForCalleeThread(long timeout) throws TimedOutException, InterruptedException
InvocationEventsWaiter
Wait 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 InvocationEventsWaiter
timeout
- 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
InvocationEventsWaiter
Wait for the thread which is running the method invocation (the "callee") to be set. This method is safe related.
waitForCalleeThread
in interface InvocationEventsWaiter
InterruptedException
- 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
InvocationEventsWaiter
Wait until the callee thread become available. This method is safe related.
waitUntilCalleeAvailable
in interface InvocationEventsWaiter
InterruptedException
public boolean cancel()
Cancelable
Cancel 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 Cancelable
true
if the related operation has been succesfully
cancelled, false
otherwisepublic boolean interrupt()
Cancelable
Interrupt 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 Cancelable
true
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 |