|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object mandala.rami.AbstractFutureClient
Abstract implementation of the FutureClient
interface.
FutureClient
Field Summary | |
AsynchronousReference |
ar
|
java.lang.Object[] |
args
|
Callback |
callback
|
ThreadOp |
caller
|
protected Cancelable |
cancelable
|
MethodOp |
method
|
Constructor Summary | |
protected |
AbstractFutureClient(AsynchronousReference ar,
MethodOp method,
java.lang.Object[] args,
ThreadOp caller,
Callback callback)
|
Method Summary | |
boolean |
cancel()
Cancel the operation related to this cancelable object. |
java.lang.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 |
getCalleeThread()
Get the thread which is running the method invocation (the "callee"). |
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. |
java.lang.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 |
isCalleeAvailable()
Test the usable value of the callee thread. |
boolean |
isCancelled()
Returns true if the asynchronous method invocation has
been cancelled. |
boolean |
isInterrupted()
Returns true if the asynchronous method invocation has
been interrupted. |
java.lang.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. |
java.lang.Object |
waitForResult()
Equivalent to waitForResult(Long.MAX_VALUE). |
java.lang.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. |
boolean |
waitUntilCalleeAvailable(long timeout)
Wait until the callee thread become available for a specified amount of time. |
void |
waitUntilResultAvailable()
Wait until the result become available. |
void |
waitUntilStarted()
Wait until the method is runned by a callee thread. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface mandala.rami.InvocationObserver |
isResultAvailable, isStarted |
Methods inherited from interface mandala.rami.MethodResult |
exceptionOccured, getException, getReturnedResultTrusted |
Methods inherited from interface mandala.rami.InvocationEventsWaiter |
waitUntilResultAvailable, waitUntilStarted |
Field Detail |
public final AsynchronousReference ar
public final MethodOp method
public final java.lang.Object[] args
public final ThreadOp caller
public final Callback callback
protected Cancelable cancelable
Constructor Detail |
protected AbstractFutureClient(AsynchronousReference ar, MethodOp method, java.lang.Object[] args, ThreadOp caller, Callback callback)
Method Detail |
public final 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 final 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 final java.lang.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 final 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 final 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 final boolean isCalleeAvailable()
InvocationObserver
Test the usable value of the callee thread. This method is safe related.
While the callee thread as not yet been set by the implementation of
asynchronous method invocation, this method returns
false
. Otherwise, it returns true
.
This method may return true
whereas InvocationObserver.getCalleeThread()
returns a null
value. This situation
means that the callee
has been set, has executed the method
and is no longer available (it has died for example).
isCalleeAvailable
in interface InvocationObserver
true
if the callee thread has been set by the
implementationResultUpdater.setCalleeThread(ThreadOp)
public final ThreadOp getCalleeThread()
InvocationObserver
Get the thread which is running the method invocation (the "callee"). This method is unsafe related.
While isCalleeAvailable()
returns false
,
the value returned is undefined. Else, the ThreadOp
instance referencing the thread which is running the method is returned
which can be null
if the method is considered
terminated.
getCalleeThread
in interface InvocationObserver
ThreadOp
public final boolean isCancelled()
InvocationObserver
Returns true
if the asynchronous method invocation has
been cancelled. This method is safe related
isCancelled
in interface InvocationObserver
boolean
valuepublic final boolean isInterrupted()
InvocationObserver
Returns true
if the asynchronous method invocation has
been interrupted. This method is safe related
isInterrupted
in interface InvocationObserver
boolean
valuepublic final java.lang.Object getReturnedResult() throws java.lang.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
java.lang.Throwable
- The exception thrown during the call.public final java.lang.Object waitForResult(long timeout) throws java.lang.Throwable, TimedOutException, java.lang.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
TimedOutException
- if the specified timeout
expires.
java.lang.Throwable
- The exception thrown by the asynchronous method
invocation.
java.lang.InterruptedException
- if another thread has interrupted the
current thread. The interrupted status of the current thread is cleared
when this exception is thrown.public final java.lang.Object waitForResult() throws java.lang.Throwable, java.lang.InterruptedException
InvocationEventsWaiter
Equivalent to waitForResult(Long.MAX_VALUE). This method is
safe related.
waitForResult
in interface InvocationEventsWaiter
java.lang.InterruptedException
- if the thread has been interrupted
java.lang.Throwable
- the exception thrown by the asynchronous method
invocation.public final void waitUntilResultAvailable() throws java.lang.InterruptedException
InvocationEventsWaiter
Wait until the result become available. This method is safe related.
waitUntilResultAvailable
in interface InvocationEventsWaiter
java.lang.InterruptedException
public final ThreadOp waitForCalleeThread() throws java.lang.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
java.lang.InterruptedException
- if another thread has interrupted the
current thread. The interrupted status of the current thread is cleared
when this exception is thrown.public final ThreadOp waitForCalleeThread(long timeout) throws java.lang.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).
java.lang.InterruptedException
- if another thread has interrupted the
current thread. The interrupted status of the current thread is cleared
when this exception is thrown.public final void waitUntilCalleeAvailable() throws java.lang.InterruptedException
InvocationEventsWaiter
Wait until the callee thread become available. This method is safe related.
waitUntilCalleeAvailable
in interface InvocationEventsWaiter
java.lang.InterruptedException
public final boolean waitUntilCalleeAvailable(long timeout) throws java.lang.InterruptedException
InvocationEventsWaiter
Wait until the callee thread become available for a specified amount of time. This method is safe related.
If the callee is not available, wait timeout
before
returning.
waitUntilCalleeAvailable
in interface InvocationEventsWaiter
timeout
- the maximum time to wait in milliseconds (0 means wait
for ever).
java.lang.InterruptedException
public final void waitUntilStarted() throws java.lang.InterruptedException
InvocationEventsWaiter
Wait until the method is runned by a callee thread. This method is safe related.
waitUntilStarted
in interface InvocationEventsWaiter
java.lang.InterruptedException
public final 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 final 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 java.lang.String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |