T - the type of the value wrapped by this classstatic final class ConcurrentUtils.ConstantFuture<T>
extends java.lang.Object
implements java.util.concurrent.Future<T>
Future implementation which wraps a constant value.| Constructor and Description |
|---|
ConstantFuture(T value)
Creates a new instance of
ConstantFuture and initializes it
with the constant value. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancel(boolean mayInterruptIfRunning)
The cancel operation is not supported.
|
T |
get()
This implementation just returns the constant value.
|
T |
get(long timeout,
java.util.concurrent.TimeUnit unit)
This implementation just returns the constant value; it
does not block, therefore the timeout has no meaning.
|
boolean |
isCancelled()
This implementation always returns false; there
is no background process which could be cancelled.
|
boolean |
isDone()
This implementation always returns true because
the constant object managed by this
Future implementation is
always available. |
private final T value
ConstantFuture(T value)
ConstantFuture and initializes it
with the constant value.value - the value (may be null)public boolean isDone()
Future implementation is
always available.isDone in interface java.util.concurrent.Future<T>public T get()
get in interface java.util.concurrent.Future<T>public T get(long timeout, java.util.concurrent.TimeUnit unit)
get in interface java.util.concurrent.Future<T>public boolean isCancelled()
isCancelled in interface java.util.concurrent.Future<T>public boolean cancel(boolean mayInterruptIfRunning)
cancel in interface java.util.concurrent.Future<T>