T
- the type of this Future
S
- the type of the adaptee's Future
public abstract class FutureAdapter<T,S>
extends java.lang.Object
implements java.util.concurrent.Future<T>
Future
parameterized over S into a Future
parameterized over T. All methods are delegated to the adaptee, where get()
and get(long, TimeUnit)
call adapt(Object)
on the adaptee's result.Modifier | Constructor and Description |
---|---|
protected |
FutureAdapter(java.util.concurrent.Future<S> adaptee)
Constructs a new
FutureAdapter with the given adaptee. |
Modifier and Type | Method and Description |
---|---|
protected abstract T |
adapt(S adapteeResult)
Adapts the given adaptee's result into T.
|
boolean |
cancel(boolean mayInterruptIfRunning) |
T |
get() |
T |
get(long timeout,
java.util.concurrent.TimeUnit unit) |
protected java.util.concurrent.Future<S> |
getAdaptee()
Returns the adaptee.
|
boolean |
isCancelled() |
boolean |
isDone() |
protected FutureAdapter(java.util.concurrent.Future<S> adaptee)
FutureAdapter
with the given adaptee.adaptee
- the future to delegate toprotected java.util.concurrent.Future<S> getAdaptee()
public boolean cancel(boolean mayInterruptIfRunning)
cancel
in interface java.util.concurrent.Future<T>
public boolean isCancelled()
isCancelled
in interface java.util.concurrent.Future<T>
public boolean isDone()
isDone
in interface java.util.concurrent.Future<T>
@Nullable public T get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
get
in interface java.util.concurrent.Future<T>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
@Nullable public T get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
get
in interface java.util.concurrent.Future<T>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException