Package org.redisson.misc
Interface RPromise<T>
-
- Type Parameters:
T
- type
- All Known Implementing Classes:
BatchPromise
,PromiseDelegator
,RedissonExecutorBatchFuture
,RedissonExecutorFuture
,RedissonPromise
,RedissonScheduledFuture
,RemotePromise
public interface RPromise<T> extends RFuture<T>
- Author:
- Nikita Koksharov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description RPromise<T>
addListener(io.netty.util.concurrent.FutureListener<? super T> listener)
Adds the specified listener to this future.RPromise<T>
addListeners(io.netty.util.concurrent.FutureListener<? super T>... listeners)
Adds the specified listeners to this future.RPromise<T>
await()
Waits for this future to be completed.RPromise<T>
awaitUninterruptibly()
Waits for this future to be completed without interruption.boolean
hasListeners()
RPromise<T>
removeListener(io.netty.util.concurrent.FutureListener<? super T> listener)
Removes the first occurrence of the specified listener from this future.RPromise<T>
removeListeners(io.netty.util.concurrent.FutureListener<? super T>... listeners)
Removes the first occurrence for each of the listeners from this future.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.boolean
tryFailure(Throwable 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 interface org.redisson.api.RFuture
await, await, awaitUninterruptibly, awaitUninterruptibly, cause, getNow, isSuccess
-
-
-
-
Method Detail
-
trySuccess
boolean trySuccess(T result)
Marks this future as a success and notifies all listeners.- 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.
-
tryFailure
boolean tryFailure(Throwable cause)
Marks this future as a failure and notifies all listeners.- 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
boolean setUncancellable()
Make this future impossible to cancel.- 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.
-
addListener
RPromise<T> addListener(io.netty.util.concurrent.FutureListener<? super T> listener)
Description copied from interface:RFuture
Adds the specified listener to this future. The specified listener is notified when this future is done. If this future is already completed, the specified listener is notified immediately.- Specified by:
addListener
in interfaceRFuture<T>
- Parameters:
listener
- - listener for future object- Returns:
- Future object
-
addListeners
RPromise<T> addListeners(io.netty.util.concurrent.FutureListener<? super T>... listeners)
Description copied from interface:RFuture
Adds the specified listeners to this future. The specified listeners are notified when this future is done. If this future is already completed, the specified listeners are notified immediately.- Specified by:
addListeners
in interfaceRFuture<T>
- Parameters:
listeners
- - listeners for future object- Returns:
- Future object
-
removeListener
RPromise<T> removeListener(io.netty.util.concurrent.FutureListener<? super T> listener)
Description copied from interface:RFuture
Removes the first occurrence of the specified listener from this future. The specified listener is no longer notified when this future is done. If the specified listener is not associated with this future, this method does nothing and returns silently.- Specified by:
removeListener
in interfaceRFuture<T>
- Parameters:
listener
- - listener for future object- Returns:
- Future object
-
removeListeners
RPromise<T> removeListeners(io.netty.util.concurrent.FutureListener<? super T>... listeners)
Description copied from interface:RFuture
Removes the first occurrence for each of the listeners from this future. The specified listeners are no longer notified when this future is done. If the specified listeners are not associated with this future, this method does nothing and returns silently.- Specified by:
removeListeners
in interfaceRFuture<T>
- Parameters:
listeners
- - listeners for future object- Returns:
- Future object
-
await
RPromise<T> await() throws InterruptedException
Description copied from interface:RFuture
Waits for this future to be completed.- Specified by:
await
in interfaceRFuture<T>
- Returns:
- Future object
- Throws:
InterruptedException
- if the current thread was interrupted
-
awaitUninterruptibly
RPromise<T> awaitUninterruptibly()
Description copied from interface:RFuture
Waits for this future to be completed without interruption. This method catches anInterruptedException
and discards it silently.- Specified by:
awaitUninterruptibly
in interfaceRFuture<T>
- Returns:
- Future object
-
sync
RPromise<T> sync() throws InterruptedException
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:
sync
in interfaceRFuture<T>
- Returns:
- Future object
- Throws:
InterruptedException
- if the current thread was interrupted
-
syncUninterruptibly
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>
- Returns:
- Future object
-
hasListeners
boolean hasListeners()
-
-