public class SimpleCompletedFuture<E> extends Object implements InternalCompletableFuture<E>
InternalCompletableFuture
.Constructor and Description |
---|
SimpleCompletedFuture(E result)
Creates a completed future with the given result.
|
SimpleCompletedFuture(Throwable exceptionalResult) |
Modifier and Type | Method and Description |
---|---|
void |
andThen(ExecutionCallback<E> callback)
Registers a callback that will run after this future is completed.
|
void |
andThen(ExecutionCallback<E> 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.
|
E |
get() |
E |
get(long timeout,
TimeUnit unit) |
boolean |
isCancelled() |
boolean |
isDone() |
E |
join()
Waits for this future to complete.
|
public SimpleCompletedFuture(E result)
Note: If the result is an instance of Throwable, this future will be
completed exceptionally. That is, get()
will throw the exception
rather than return it.
public SimpleCompletedFuture(Throwable exceptionalResult)
public E join()
InternalCompletableFuture
join
in interface InternalCompletableFuture<E>
public boolean complete(Object value)
InternalCompletableFuture
complete
in interface InternalCompletableFuture<E>
value
- the value to complete this future with.true
if this invocation caused this InternalCompletableFuture to complete, else false
public void andThen(ExecutionCallback<E> 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<E>
callback
- the callback to executepublic void andThen(ExecutionCallback<E> callback, Executor executor)
ICompletableFuture
executor
.
Please note that there is no ordering guarantee for executing multiple
callbacks.andThen
in interface ICompletableFuture<E>
callback
- the callback to executeexecutor
- the executor in which the callback will be runpublic boolean cancel(boolean mayInterruptIfRunning)
public boolean isCancelled()
isCancelled
in interface Future<E>
public E get() throws ExecutionException
get
in interface Future<E>
ExecutionException
public E get(long timeout, TimeUnit unit) throws ExecutionException
get
in interface Future<E>
ExecutionException
Copyright © 2022 Hazelcast, Inc.. All Rights Reserved.