V - public abstract class AbstractInvocationFuture<V> extends Object implements InternalCompletableFuture<V>
The long term goal is that this whole class can be ripped out and replaced by the
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()
InternalCompletableFuturejoin 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>InterruptedExceptionExecutionExceptionpublic final V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get in interface Future<V>InterruptedExceptionExecutionExceptionTimeoutExceptionpublic final void andThen(ExecutionCallback<V> callback)
ICompletableFutureandThen in interface ICompletableFuture<V>callback - the callback to executepublic final void andThen(ExecutionCallback<V> callback, Executor executor)
ICompletableFutureandThen 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 © 2017 Hazelcast, Inc.. All Rights Reserved.