public class GridPlainFutureAdapter<R> extends Object implements GridPlainFuture<R>
| Constructor and Description |
|---|
GridPlainFutureAdapter()
Creates not-finished future without any result.
|
GridPlainFutureAdapter(R res)
Creates succeeded finished future with given result.
|
GridPlainFutureAdapter(Throwable err)
Creates failed finished future with given error.
|
| Modifier and Type | Method and Description |
|---|---|
<T> GridPlainFutureAdapter<T> |
chain(GridPlainClosure<GridPlainFuture<R>,T> cb)
Creates future's chain and completes chained future, when this future finishes.
|
R |
get()
Synchronously waits for completion and returns result.
|
R |
get(long timeout,
TimeUnit unit)
Synchronously waits for completion and returns result.
|
boolean |
isDone()
Checks if future is done.
|
void |
listenAsync(GridPlainInClosure<GridPlainFuture<R>>... lsnrs)
Register new listeners for notification when future completes.
|
void |
onDone(R res)
Callback to notify that future is finished successfully.
|
void |
onDone(Throwable err)
Callback to notify that future is finished with error.
|
void |
stopListenAsync(GridPlainInClosure<GridPlainFuture<R>>... lsnrs)
Removes listeners registered before.
|
public GridPlainFutureAdapter()
public GridPlainFutureAdapter(R res)
res - Future result.public GridPlainFutureAdapter(Throwable err)
err - Future error.public R get() throws IgniteCheckedException
get in interface GridPlainFuture<R>IgniteCheckedException - In case of error.public R get(long timeout, TimeUnit unit) throws IgniteCheckedException
get in interface GridPlainFuture<R>timeout - Timeout interval to wait future completes.unit - Timeout interval unit to wait future completes.IgniteCheckedException - In case of error.IgniteFutureTimeoutCheckedException - If timed out before future finishes.public boolean isDone()
isDone in interface GridPlainFuture<R>public void onDone(R res)
res - Result (can be null).public void onDone(Throwable err)
err - Error (can't be null).public void listenAsync(GridPlainInClosure<GridPlainFuture<R>>... lsnrs)
listenAsync in interface GridPlainFuture<R>lsnrs - Listeners to be registered.public void stopListenAsync(GridPlainInClosure<GridPlainFuture<R>>... lsnrs)
stopListenAsync in interface GridPlainFuture<R>lsnrs - Listeners to be removed.public <T> GridPlainFutureAdapter<T> chain(GridPlainClosure<GridPlainFuture<R>,T> cb)
chain in interface GridPlainFuture<R>T - New future format to convert this finished future to.cb - Future callback to convert this future result into expected format.
Follow @ApacheIgnite
Ignite Fabric : ver. 1.0.0-RC1 Release Date : February 17 2015