mandala.rami
Interface InvocationEventsWaiter

All Known Subinterfaces:
FutureClient, RemoteFutureClient, RemoteInvocationEventsWaiter
All Known Implementing Classes:
AbstractFutureClient, RemoteInvocationEventsWaiterProxy

public interface InvocationEventsWaiter

This interface defines the behavior a waiter of an asynchronous method invocation must have.

This interface provides methods to wait for the availability of the result or of the callee thread of the asynchronous call.

Every methods of this interface are safe related meaning the result they return is always valid.

Version:
1.0
Author:
eipi
See Also:
InvocationInfo, InvocationObserver, MethodResult, FutureClient

Method Summary
 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.
 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.
 boolean waitUntilResultAvailable(long timeout)
          Wait until the result become available for a specified amount of time.
 

Method Detail

waitForResult

public Object waitForResult()
                     throws Throwable,
                            InterruptedException

Equivalent to waitForResult(Long.MAX_VALUE). This method is safe related.

Returns:
The object returned by the asynchronous method invocation.
Throws:
Throwable - the exception thrown by the asynchronous method invocation.
InterruptedException - if the thread has been interrupted

waitForResult

public Object waitForResult(long timeout)
                     throws Throwable,
                            InterruptedException,
                            TimedOutException

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.

Returns:
The object returned by the asynchronous method invocation.
Throws:
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.

waitUntilResultAvailable

public boolean waitUntilResultAvailable(long timeout)
                                 throws InterruptedException

Wait until the result become available for a specified amount of time. This method is safe related.

If the result is not available, wait timeout before returning.

Parameters:
timeout - the maximum time to wait in milliseconds.
Returns:
true if the result is available, false if the timeout expires.
Throws:
InterruptedException

waitUntilResultAvailable

public void waitUntilResultAvailable()
                              throws InterruptedException

Wait until the result become available. This method is safe related.

Throws:
InterruptedException

waitUntilCalleeAvailable

public boolean waitUntilCalleeAvailable(long timeout)
                                 throws InterruptedException

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.

Parameters:
timeout - the maximum time to wait in milliseconds (0 means wait for ever).
Returns:
true if the callee thread is available, false if the timeout expires.
Throws:
InterruptedException

waitUntilCalleeAvailable

public void waitUntilCalleeAvailable()
                              throws InterruptedException

Wait until the callee thread become available. This method is safe related.

Throws:
InterruptedException

waitForCalleeThread

public ThreadOp waitForCalleeThread(long timeout)
                             throws TimedOutException,
                                    InterruptedException

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.

Parameters:
timeout - the maximum time to wait in milliseconds (0 means wait for ever).
Returns:
the callee thread.
Throws:
InterruptedException - if another thread has interrupted the current thread. The interrupted status of the current thread is cleared when this exception is thrown.
TimedOutException

waitForCalleeThread

public ThreadOp waitForCalleeThread()
                             throws InterruptedException

Wait for the thread which is running the method invocation (the "callee") to be set. This method is safe related.

Returns:
the callee thread.
Throws:
InterruptedException - if another thread has interrupted the current thread. The interrupted status of the current thread is cleared when this exception is thrown.


Mandala help mailing list