V
- public abstract class AbstractInvocationFuture<V> extends Object implements InternalCompletableFuture<V>
java.util.concurrent.CompletableFuture
. So we need to be very careful with adding more
functionality to this class because the more we add, the more difficult the replacement will be.Modifier and Type | Field and Description |
---|---|
protected Executor |
defaultExecutor |
protected ILogger |
logger |
Constructor and Description |
---|
AbstractInvocationFuture(Executor defaultExecutor,
ILogger logger) |
Modifier and Type | Method and Description |
---|---|
void |
andThen(ExecutionCallback<V> callback)
Registers a callback that will run after the future is completed.
|
void |
andThen(ExecutionCallback<V> callback,
Executor executor)
Registers a callback that will run with the provided executor after the future is completed.
|
boolean |
cancel(boolean mayInterruptIfRunning) |
boolean |
complete(Object value)
Can be called multiple times, but only the first answer will lead to the future getting triggered.
|
V |
get() |
V |
get(long timeout,
TimeUnit unit) |
V |
getSafely() |
protected Object |
getState() |
protected abstract String |
invocationToString() |
boolean |
isCancelled() |
boolean |
isDone() |
V |
join()
Waits for this future to complete.
|
protected abstract TimeoutException |
newTimeoutException(long timeout,
TimeUnit unit) |
protected void |
onInterruptDetected() |
protected Object |
resolve(Object value) |
protected abstract V |
resolveAndThrow(Object state) |
String |
toString() |
protected Throwable |
unwrap(Throwable throwable) |
protected final Executor defaultExecutor
protected final ILogger logger
protected final Object getState()
protected void onInterruptDetected()
public final boolean cancel(boolean mayInterruptIfRunning)
public final boolean isCancelled()
isCancelled
in interface Future<V>
public final V join()
InternalCompletableFuture
join
in interface InternalCompletableFuture<V>
public final V getSafely()
getSafely
in interface InternalCompletableFuture<V>
public final V get() throws InterruptedException, ExecutionException
get
in interface Future<V>
InterruptedException
ExecutionException
public final V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<V>
InterruptedException
ExecutionException
TimeoutException
public final void andThen(ExecutionCallback<V> callback)
ICompletableFuture
andThen
in interface ICompletableFuture<V>
callback
- the callback to executepublic final void andThen(ExecutionCallback<V> callback, Executor executor)
ICompletableFuture
andThen
in interface ICompletableFuture<V>
callback
- the callback to executeexecutor
- the executor in which the callback will be runprotected abstract String invocationToString()
protected abstract V resolveAndThrow(Object state) throws ExecutionException, InterruptedException
protected abstract TimeoutException newTimeoutException(long timeout, TimeUnit unit)
public final boolean complete(Object value)
value
- The type of response to offer.Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.