| Modifier and Type | Class and Description |
|---|---|
| private static interface |
| Modifier and Type | Field and Description |
|---|---|
| private Queue | actions
The queue of actions is filled when calling onComplete() before the Future is completed or cancelled. |
| private volatile boolean | cancelled
Indicates if this Future is cancelled GuardedBy("lock") |
| private final Executor | executor
Used to start new threads. |
| private final Lock | lock
Used to synchronize state changes. |
| private Thread | thread
The Thread which runs the computation. |
| private volatile Option | value
Once the Future is completed, the value is defined. |
| private Queue | waiters
The queue of waiters is filled when calling await() before the Future is completed or cancelled. |
| Access | Constructor and Description |
|---|---|
| private | FutureImpl(Executor executor, Option<Try<T>> value, Queue<Consumer<Try<T>>> actions, Queue<Thread> waiters, FutureImpl.
|
| Modifier and Type | Method and Description |
|---|---|
| private void | _await(long
the start time in nanos, based on System#nanoTime() start, long a timeout in the given timeout, TimeUnit unit of timea time unit unit)Blocks the current thread. |
| pack-priv static < value type of the Future T> FutureImpl | Returns: a newFutureImpl instanceAn executor, Task<? extends T> Executor to run and control the computation and to perform the actions.A (possibly blocking) computation task)
References Deprecated
Task is deprecated or references (maybe indirectly) at least one deprecated element.
Creates a |
| public Future | await()
Implements io. Blocks the current Thread until this Future completed or returns immediately if this Future is already completed. |
| public Future | await(long
the maximum time to wait timeout, TimeUnit the time unit of the timeout argument unit)Implements io. Blocks the current Thread until this Future completed or returns immediately if this Future is already completed. |
| public boolean | cancel(boolean
true if a running thread should be interrupted, otherwise a running thread
is allowed to complete its computation.Implements io. Cancels the Future. |
| public Executor | executor()
Overrides default io. Returns the |
| public ExecutorService | executorService()
Implements io.
Deprecated
This method is deprecated. |
| public Option | |
| private void | |
| public boolean | isCancelled()
Implements io. Checks if this Future is cancelled, i.e. the thread was forced to stop before completion. |
| public boolean | isCompleted()
Implements io. Checks if this Future is completed, i.e. has a value. |
| pack-priv static < value type of the Future T> FutureImpl | Returns: a newFutureImpl instanceAn executor)Executor to run and control the computation and to perform the actions.Creates a |
| pack-priv static < value type of the Future T> FutureImpl | |
| public Future | onComplete(Consumer<? super Try<T>>
An action to be performed when this future is complete. action)Implements io. Performs the action once the Future is complete. |
| private void | |
| pack-priv static < value type of the Future T> FutureImpl | Returns: a newFutureImpl instanceAn executor, Task<? extends T> Executor to run and control the computation and to perform the actions.A non-blocking computation task)
References Deprecated
Task is deprecated or references (maybe indirectly) at least one deprecated element.
Creates a |
| public String | toString()
Overrides java. Implements io. Clarifies that values have a proper toString() method implemented. |
| pack-priv boolean | tryComplete(Try<? extends T>
A Success containing a result or a Failure containing an Exception. value)INTERNAL METHOD, SHOULD BE USED BY THE CONSTRUCTOR, ONLY. |
| private void | |
| private void |
| actions | back to summary |
|---|---|
| private Queue<Consumer<Try<T>>> actions The queue of actions is filled when calling onComplete() before the Future is completed or cancelled. Otherwise actions = null. GuardedBy("lock") | |
| cancelled | back to summary |
|---|---|
| private volatile boolean cancelled Indicates if this Future is cancelled GuardedBy("lock") | |
| executor | back to summary |
|---|---|
| private final Executor executor Used to start new threads. | |
| lock | back to summary |
|---|---|
| private final Lock lock Used to synchronize state changes. | |
| thread | back to summary |
|---|---|
| private Thread thread The Thread which runs the computation. GuardedBy("lock") | |
| value | back to summary |
|---|---|
| private volatile Option<Try<T>> value Once the Future is completed, the value is defined. GuardedBy("lock") | |
| waiters | back to summary |
|---|---|
| private Queue<Thread> waiters The queue of waiters is filled when calling await() before the Future is completed or cancelled. Otherwise waiters = null. GuardedBy("lock") | |
| FutureImpl | back to summary |
|---|---|
| private FutureImpl(Executor executor, Option<Try<T>> value, Queue<Consumer<Try<T>>> actions, Queue<Thread> waiters, FutureImpl. | |
| _await | back to summary |
|---|---|
| private void _await(long start, long timeout, TimeUnit unit) Blocks the current thread.
If timeout = 0 then
If a timeout > -1 is specified and the deadline is not met, this Future fails with a
If this Thread was interrupted, this Future fails with a
| |
| async | back to summary |
|---|---|
| pack-priv static <T> FutureImpl References Deprecated
See corresponding docs for further information. Creates a
| |
| await | back to summary |
|---|---|
| public Future Implements io. Doc from io. Blocks the current Thread until this Future completed or returns immediately if this Future is already completed.
In the case the current thread was interrupted while waiting, a failed | |
| await | back to summary |
|---|---|
| public Future Implements io. Doc from io. Blocks the current Thread until this Future completed or returns immediately if this Future is already completed.
In the case the current thread was interrupted while waiting, a failed
If the deadline wasn't met, a failed | |
| cancel | back to summary |
|---|---|
| public boolean cancel(boolean mayInterruptIfRunning) Implements io. Doc from io. Cancels the Future. A pending Future may be interrupted, depending on the underlying
If the Future was successfully cancelled, the result is a
| |
| executor | back to summary |
|---|---|
| public Executor executor() Overrides default io. Doc from io. Returns the | |
| executorService | back to summary |
|---|---|
| public ExecutorService executorService() Implements io. Doc from io. Deprecated
This method is deprecated.
THE DEFAULT IMPLEMENTATION (obtained by one of the
| |
| getValue | back to summary |
|---|---|
| public Option Implements io. Doc from io. Returns the value of the Future. | |
| handleUncaughtException | back to summary |
|---|---|
| private void handleUncaughtException(Throwable x) | |
| isCancelled | back to summary |
|---|---|
| public boolean isCancelled() Implements io. Doc from io. Checks if this Future is cancelled, i.e. the thread was forced to stop before completion.
| |
| isCompleted | back to summary |
|---|---|
| public boolean isCompleted() Implements io. Doc from io. Checks if this Future is completed, i.e. has a value.
| |
| of | back to summary |
|---|---|
| pack-priv static <T> FutureImpl Creates a
| |
| of | back to summary |
|---|---|
| pack-priv static <T> FutureImpl Creates a
| |
| onComplete | back to summary |
|---|---|
| public Future Implements io. Doc from io. Performs the action once the Future is complete.
| |
| perform | back to summary |
|---|---|
| private void perform(Consumer<? super Try<T>> action) | |
| sync | back to summary |
|---|---|
| pack-priv static <T> FutureImpl References Deprecated
See corresponding docs for further information. Creates a
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Implements io. Doc from io. Clarifies that values have a proper toString() method implemented. See Object.toString(). | |
| tryComplete | back to summary |
|---|---|
| pack-priv boolean tryComplete(Try<? extends T> value) INTERNAL METHOD, SHOULD BE USED BY THE CONSTRUCTOR, ONLY. Completes this Future with a value and performs all actions. This method is idempotent. I.e. it does nothing, if this Future is already completed.
| |
| unlock | back to summary |
|---|---|
| private void unlock(Thread waiter) | |
| updateThread | back to summary |
|---|---|
| private void updateThread() | |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| execute | back to summary |
|---|---|
| public void execute(Task. | |