Class SettableFuture<V>
java.lang.Object
org.glassfish.jersey.internal.guava.AbstractFuture<V>
org.glassfish.jersey.internal.guava.SettableFuture<V>
- All Implemented Interfaces:
Future<V>
,ListenableFuture<V>
A
ListenableFuture
whose result may be set by a set(Object)
or setException(Throwable)
call. It may also be cancelled.- Since:
- 9.0 (in 1.0 as
ValueFuture
) - Author:
- Sven Mawson
-
Method Summary
Modifier and TypeMethodDescriptionstatic <V> SettableFuture<V>
create()
Creates a newSettableFuture
in the default state.boolean
Sets the value of this future.boolean
setException
(Throwable throwable) Sets the future to having failed with the given exception.Methods inherited from class org.glassfish.jersey.internal.guava.AbstractFuture
addListener, cancel, get, get, isCancelled, isDone
-
Method Details
-
create
Creates a newSettableFuture
in the default state. -
set
Sets the value of this future. This method will returntrue
if the value was successfully set, orfalse
if the future has already been set or cancelled.- Parameters:
value
- the value the future should hold.- Returns:
- true if the value was successfully set.
-
setException
Sets the future to having failed with the given exception. This exception will be wrapped in anExecutionException
and thrown from theget
methods. This method will returntrue
if the exception was successfully set, orfalse
if the future has already been set or cancelled.- Parameters:
throwable
- the exception the future should hold.- Returns:
- true if the exception was successfully set.
-