public class FutureCallback<C> extends Object implements Future<C>, Callback<C>
Callback.Empty<C>
Constructor and Description |
---|
FutureCallback() |
FutureCallback(C ctx) |
FutureCallback(C ctx,
Throwable failed) |
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
void |
completed(C context)
Callback invoked when the operation completes.
|
void |
failed(C context,
Throwable cause)
Callback invoked when the operation fails.
|
C |
get() |
C |
get(long timeout,
TimeUnit unit) |
boolean |
isCancelled() |
boolean |
isDone() |
static void |
rethrow(ExecutionException e) |
String |
toString() |
public FutureCallback()
public FutureCallback(C ctx)
public void completed(C context)
Callback
Callback invoked when the operation completes.
completed
in interface Callback<C>
context
- the contextCallback.failed(Object, Throwable)
public void failed(C context, Throwable cause)
Callback
Callback invoked when the operation fails.
public boolean cancel(boolean mayInterruptIfRunning)
public boolean isCancelled()
isCancelled
in interface Future<C>
public C get() throws InterruptedException, ExecutionException
get
in interface Future<C>
InterruptedException
ExecutionException
public C get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<C>
InterruptedException
ExecutionException
TimeoutException
public static void rethrow(ExecutionException e) throws IOException
IOException
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.