| java.lang.Object com.tc.util.concurrent.TCFuture
TCFuture | public class TCFuture (Code) | | Class to hold "future" results. This class inspired by FutureResult from util.concurrent, but without
mandating the use of Runnable and/or Callable interfaces
author: teck |
Method Summary | |
public void | cancel() Cancel this future instance. | public Object | get() | public Object | get(long timeout) Get the value of this future result within the scope of the given timeout
Parameters: timeout - time (in milliseconds) to wait before throwing a timeout exception. | public Object | get(long timeout, boolean flagIfTimedOut) Get the value of this future result within the scope of the given timeout
Parameters: timeout - time (in milliseconds) to wait before throwing a timeout exception. | public void | set(Object value) Set the value of this future. | public void | setException(Throwable ex) Set the value of this future to an exception result. | public boolean | timedOut() |
TCFuture | public TCFuture()(Code) | | |
cancel | public void cancel()(Code) | | Cancel this future instance. Cancelling a future will cause any threads waiting on this future to receive an
interrupted exception instead of a result value. Calling cancel() after a value has been set does
not "unset" the value
|
get | public Object get(long timeout) throws InterruptedException, TCTimeoutException, TCExceptionResultException(Code) | | Get the value of this future result within the scope of the given timeout
Parameters: timeout - time (in milliseconds) to wait before throwing a timeout exception. A value of zero will cause thismethod to wait indefinitely and a timeout exception will never be thrown the value set in this future (which may be null) throws: InterruptedException - if the current thread is interrupted while waiting for the result to be set throws: TCTimeoutException - if timeout period expires throws: TCExceptionResultExecption - if another thread sets the future result to an exception. See Also: setException(Throwable t) |
get | public Object get(long timeout, boolean flagIfTimedOut) throws InterruptedException, TCTimeoutException, TCExceptionResultException(Code) | | Get the value of this future result within the scope of the given timeout
Parameters: timeout - time (in milliseconds) to wait before throwing a timeout exception. A value of zero will cause thismethod to wait indefinitely and a timeout exception will never be thrown Parameters: flagIfTimedOut - if set to true and a TCTimeoutException is thrown waiting for the result the timedOut()method will return true, otherwise it will continue to return false the value set in this future (which may be null) throws: InterruptedException - if the current thread is interrupted while waiting for the result to be set throws: TCTimeoutException - if timeout period expires throws: TCExceptionResultExecption - if another thread sets the future result to an exception. See Also: setException(Throwable t) |
set | public void set(Object value)(Code) | | Set the value of this future. Thread(s) waiting for the result (in method get() ) will be awoken. If
this future has been cancel() 'ed, setting the value will have no effect
Parameters: value - the value to set into this future throws: IllegalStateException - if the value has already been set in this future |
setException | public void setException(Throwable ex)(Code) | | Set the value of this future to an exception result. Thread(s) waiting for the result (in method get() )
will be awoken. If this future has been cancel() 'ed, setting the value will have no effect
Parameters: ex - the exception result for this future throws: IllegalStateException - if a result has already been set in this future |
timedOut | public boolean timedOut()(Code) | | true if a call to get(long,boolean) specified true as an argument and the call timed out, false otherwise. |
|
|