V
- public class DelegatingFuture<V> extends Object implements InternalCompletableFuture<V>
InternalCompletableFuture
implementation that delegates the real logic to an underlying
InternalCompletableFuture
and decorates it with additional behavior:
Constructor and Description |
---|
DelegatingFuture(InternalCompletableFuture future,
SerializationService serializationService) |
DelegatingFuture(InternalCompletableFuture future,
SerializationService serializationService,
V result)
Creates a DelegatingFuture
|
Modifier and Type | Method and Description |
---|---|
void |
andThen(ExecutionCallback<V> callback)
Registers a callback that will run after this future is completed.
|
void |
andThen(ExecutionCallback<V> callback,
Executor executor)
Registers a callback that will run with the provided executor after this
future is completed.
|
boolean |
cancel(boolean mayInterruptIfRunning) |
boolean |
complete(Object value)
Completes this future.
|
V |
get() |
V |
get(long timeout,
TimeUnit unit) |
protected ICompletableFuture |
getFuture() |
boolean |
isCancelled() |
boolean |
isDone() |
V |
join()
Waits for this future to complete.
|
protected void |
setError(Throwable error) |
public DelegatingFuture(InternalCompletableFuture future, SerializationService serializationService)
public DelegatingFuture(InternalCompletableFuture future, SerializationService serializationService, V result)
future
- the underlying future to delegate to.serializationService
- the SerializationService
result
- the resuling value to be used when the underlying future completes. So no matter the return
value of that future, the result will be returned by the DelegatingFuture. A null
value means that the value of the underlying future should be used.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 boolean cancel(boolean mayInterruptIfRunning)
public boolean isCancelled()
isCancelled
in interface Future<V>
public boolean complete(Object value)
InternalCompletableFuture
complete
in interface InternalCompletableFuture<V>
value
- the value to complete this future with.true
if this invocation caused this InternalCompletableFuture to complete, else false
protected void setError(Throwable error)
protected ICompletableFuture getFuture()
public V join()
InternalCompletableFuture
join
in interface InternalCompletableFuture<V>
public void andThen(ExecutionCallback<V> callback)
ICompletableFuture
Please note that there is no ordering guarantee for running multiple callbacks. It is also not guaranteed that the callback will run within the same thread that completes the future.
andThen
in interface ICompletableFuture<V>
callback
- the callback to executepublic void andThen(ExecutionCallback<V> callback, Executor executor)
ICompletableFuture
executor
.
Please note that there is no ordering guarantee for executing multiple
callbacks.andThen
in interface ICompletableFuture<V>
callback
- the callback to executeexecutor
- the executor in which the callback will be runCopyright © 2019 Hazelcast, Inc.. All Rights Reserved.