Package org.redisson.misc
Class RedissonPromise<T>
-
- <T>
-
- org.redisson.misc.RedissonPromise<T>
-
- Type Parameters:
T
- type of object
- Direct Known Subclasses:
BatchPromise
,RedissonExecutorBatchFuture
,RemotePromise
public class RedissonPromise<T> extends <T> implements RPromise<T>
- Author:
- Nikita Koksharov
-
-
Constructor Summary
Constructors Constructor Description RedissonPromise()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RPromise<T>
await()
Waits for this future to be completed.boolean
await(long timeoutMillis)
Waits for this future to be completed within the specified time limit.boolean
await(long timeout, unit)
Waits for this future to be completed within the specified time limit.RPromise<T>
awaitUninterruptibly()
Waits for this future to be completed without interruption.boolean
awaitUninterruptibly(long timeoutMillis)
Waits for this future to be completed within the specified time limit without interruption.boolean
awaitUninterruptibly(long timeout, unit)
Waits for this future to be completed within the specified time limit without interruption.boolean
cancel(boolean mayInterruptIfRunning)
cause()
Returns the cause of the failed I/O operation if the I/O operation has failed.T
getNow()
Return the result without blocking.boolean
hasListeners()
boolean
isCancelled()
boolean
isDone()
boolean
isSuccess()
Returnstrue
if and only if the I/O operation was completed successfully.static <V> RFuture<V>
cause)
static <V> RFuture<V>
newSucceededFuture(V result)
void
<? super > action)
boolean
setUncancellable()
Make this future impossible to cancel.RPromise<T>
sync()
Waits for this future until it is done, and rethrows the cause of the failure if this future failed.RPromise<T>
syncUninterruptibly()
Waits for this future until it is done, and rethrows the cause of the failure if this future failed.toString()
boolean
cause)
Marks this future as a failure and notifies all listeners.boolean
trySuccess(T result)
Marks this future as a success and notifies all listeners.-
Methods inherited from class java.util.concurrent.
, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
-
-
-
-
Method Detail
-
newFailedFuture
public static <V> cause)
-
newSucceededFuture
public static <V> RFuture<V> newSucceededFuture(V result)
-
isSuccess
public boolean isSuccess()
Description copied from interface:RFuture
Returnstrue
if and only if the I/O operation was completed successfully.
-
trySuccess
public boolean trySuccess(T result)
Description copied from interface:RPromise
Marks this future as a success and notifies all listeners.- Specified by:
trySuccess
in interfaceRPromise<T>
- Parameters:
result
- object- Returns:
true
if and only if successfully marked this future as a success. Otherwisefalse
because this future is already marked as either a success or a failure.
-
cause
public cause()
Description copied from interface:RFuture
Returns the cause of the failed I/O operation if the I/O operation has failed.
-
tryFailure
public boolean tryFailure( cause)
Description copied from interface:RPromise
Marks this future as a failure and notifies all listeners.- Specified by:
tryFailure
in interfaceRPromise<T>
- Parameters:
cause
- object- Returns:
true
if and only if successfully marked this future as a failure. Otherwisefalse
because this future is already marked as either a success or a failure.
-
setUncancellable
public boolean setUncancellable()
Description copied from interface:RPromise
Make this future impossible to cancel.- Specified by:
setUncancellable
in interfaceRPromise<T>
- Returns:
true
if and only if successfully marked this future as uncancellable or it is already done without being cancelled.false
if this future has been cancelled already.
-
await
public RPromise<T> await() throws
Description copied from interface:RFuture
Waits for this future to be completed.
-
awaitUninterruptibly
public RPromise<T> awaitUninterruptibly()
Description copied from interface:RFuture
Waits for this future to be completed without interruption. This method catches an and discards it silently.- Specified by:
awaitUninterruptibly
in interfaceRFuture<T>
- Specified by:
awaitUninterruptibly
in interfaceRPromise<T>
- Returns:
- Future object
-
sync
public RPromise<T> sync() throws
Description copied from interface:RFuture
Waits for this future until it is done, and rethrows the cause of the failure if this future failed.
-
syncUninterruptibly
public RPromise<T> syncUninterruptibly()
Description copied from interface:RFuture
Waits for this future until it is done, and rethrows the cause of the failure if this future failed.- Specified by:
syncUninterruptibly
in interfaceRFuture<T>
- Specified by:
syncUninterruptibly
in interfaceRPromise<T>
- Returns:
- Future object
-
await
public boolean await(long timeout, unit) throws
Description copied from interface:RFuture
Waits for this future to be completed within the specified time limit.
-
await
public boolean await(long timeoutMillis) throws
Description copied from interface:RFuture
Waits for this future to be completed within the specified time limit.
-
awaitUninterruptibly
public boolean awaitUninterruptibly(long timeout, unit)
Description copied from interface:RFuture
Waits for this future to be completed within the specified time limit without interruption. This method catches an and discards it silently.- Specified by:
awaitUninterruptibly
in interfaceRFuture<T>
- Parameters:
timeout
- - timeout valueunit
- - timeout unit value- Returns:
true
if and only if the future was completed within the specified time limit
-
awaitUninterruptibly
public boolean awaitUninterruptibly(long timeoutMillis)
Description copied from interface:RFuture
Waits for this future to be completed within the specified time limit without interruption. This method catches an and discards it silently.- Specified by:
awaitUninterruptibly
in interfaceRFuture<T>
- Parameters:
timeoutMillis
- - timeout value- Returns:
true
if and only if the future was completed within the specified time limit
-
getNow
public T getNow()
Description copied from interface:RFuture
Return the result without blocking. If the future is not done yet this will returnnull
. As it is possible that anull
value is used to mark the future as successful you also need to check if the future is really done with and not relay on the returnednull
value.
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
-
hasListeners
public boolean hasListeners()
- Specified by:
hasListeners
in interfaceRPromise<T>
-
toString
public toString()
- Overrides:
in class
<T>
-
onComplete
public void onComplete(<? super > action)
- Specified by:
onComplete
in interfaceRFuture<T>
-
-