V
- the value typeCompletableFuture
instead.public class SettableFuture<V> extends Object implements Future<V>
Future
. Its result may be set via set(Object)
, an error may be signalized via
setError(Throwable)
. It may also be canceled via cancel(boolean)
.
This class will be superfluous with Java 8 since it provides the class CompletableFuture
with a lot more
features.
Constructor and Description |
---|
SettableFuture()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning)
Deprecated.
|
V |
get()
Deprecated.
|
V |
get(long timeout,
TimeUnit unit)
Deprecated.
|
boolean |
isCancelled()
Deprecated.
|
boolean |
isDone()
Deprecated.
|
V |
poll()
Deprecated.
Gets the future result, but returns immediately if no result is available yet
|
void |
set(V result)
Deprecated.
|
void |
setError(Throwable error)
Deprecated.
Signals an error which will cause an
ExecutionException on subsequent calls of the getter methods. |
public boolean cancel(boolean mayInterruptIfRunning)
public boolean isCancelled()
isCancelled
in interface Future<V>
public V poll() throws ExecutionException
null
if no result is available yetExecutionException
- if an error was signalized via setError(Throwable)
CancellationException
- if the future was cancelled via cancel(boolean)
public V get() throws InterruptedException, ExecutionException
get
in interface Future<V>
InterruptedException
ExecutionException
public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<V>
InterruptedException
ExecutionException
TimeoutException
public void set(V result)
result
- The result of this Future
IllegalStateException
- if a result or an error has already been setpublic void setError(Throwable error)
ExecutionException
on subsequent calls of the getter methods.IllegalStateException
- if a result or an error has already been setCopyright © 2024 levigo holding gmbh. All rights reserved.