V
- the type of the StateServerResult returned via Future.get()
operations.public interface StateServerFuture<V> extends ListenableFuture<V>
Future
specialization allowing DataAccessor
clients to retrieve the result
of an asynchronous StateServer request. StateServerFuture
provides methods for
unwrapping the ExecutionException
s thrown from Future.get()
and
Future.get(long, TimeUnit)
as StateServerException
s.Future
Modifier and Type | Method and Description |
---|---|
V |
getWithExceptionUnwrap()
Waits if necessary for the computation to complete, and then retrieves its result.
|
V |
getWithExceptionUnwrap(long timeout,
java.util.concurrent.TimeUnit unit)
Waits if necessary for the computation to complete, and then retrieves its result.
|
addListener, removeListener
V getWithExceptionUnwrap() throws StateServerException
Waits if necessary for the computation to complete, and then retrieves its result. Any
Exception
s are unwrapped/wrapped as necessary and thrown as
StateServerException
s.
Future.get()
. If Future.get()
throws an
ExecutionException
, this method examines Throwable.getCause()
.
If the cause is a StateServerException
, the StateServerException is
thrown. If the cause is a RuntimeException
or Error
the cause is thrown.
Otherwise, if cause resulted from an I/O operation in sending or receiving the message and
is wrapped as a StateServerChannelException
and thrown.StateServerException
- if the StateServer request resulted in an exception.Future.get()
V getWithExceptionUnwrap(long timeout, java.util.concurrent.TimeUnit unit) throws StateServerException, java.util.concurrent.TimeoutException
Waits if necessary for the computation to complete, and then retrieves its result. Any
Exception
s are unwrapped/wrapped as necessary and thrown as
StateServerException
s.
Future.get()
. If Future.get()
throws an
ExecutionException
, this method examines Throwable.getCause()
.
If the cause is a StateServerException
, the StateServerException is
thrown. If the cause is a RuntimeException
or Error
the cause is thrown.
Otherwise, cause resulted from the I/O operation in sending or receiving the message and
is wrapped as a StateServerChannelException
and thrown.timeout
- the maximum time to waitunit
- the time unit of the timeout argumentStateServerException
- if the StateServer request resulted in an exception.java.util.concurrent.TimeoutException
- if the timeout expired before the operation was completed.Future.get(long, TimeUnit)