V - public abstract class AbstractInvocationFuture<V> extends Object implements InternalCompletableFuture<V>
CompletableFuture.
The long term goal is that this whole class can be ripped out and replaced
by CompletableFuture from the JDK. 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.
TODO: - thread value protection
| Modifier and Type | Field and Description |
|---|---|
protected Executor |
defaultExecutor |
protected ILogger |
logger |
| Modifier | Constructor and Description |
|---|---|
protected |
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) |
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 |
onComplete() |
protected void |
onInterruptDetected() |
protected Object |
resolve(Object value) |
protected abstract V |
resolveAndThrowIfException(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 boolean cancel(boolean mayInterruptIfRunning)
public boolean isCancelled()
isCancelled in interface Future<V>public final V join()
InternalCompletableFuturejoin 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 void andThen(ExecutionCallback<V> callback)
ICompletableFutureandThen in interface ICompletableFuture<V>callback - the callback to executepublic 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 resolveAndThrowIfException(Object state) throws ExecutionException, InterruptedException
protected abstract TimeoutException newTimeoutException(long timeout, TimeUnit unit)
public final boolean complete(Object value)
complete in interface InternalCompletableFuture<V>value - The type of response to offer.protected void onComplete()
Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.