Package org.redisson.api
Interface RFuture<V>
-
- Type Parameters:
V
- type of value
- All Superinterfaces:
Future<V>
- All Known Subinterfaces:
RExecutorBatchFuture
,RExecutorFuture<V>
,RPromise<T>
,RScheduledFuture<V>
- All Known Implementing Classes:
BatchPromise
,PromiseDelegator
,RedissonExecutorBatchFuture
,RedissonExecutorFuture
,RedissonPromise
,RedissonScheduledFuture
,RemotePromise
public interface RFuture<V> extends Future<V>
Represents the result of an asynchronous computation- Author:
- Nikita Koksharov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description RFuture<V>
addListener(io.netty.util.concurrent.FutureListener<? super V> listener)
Adds the specified listener to this future.RFuture<V>
addListeners(io.netty.util.concurrent.FutureListener<? super V>... listeners)
Adds the specified listeners to this future.RFuture<V>
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, TimeUnit unit)
Waits for this future to be completed within the specified time limit.RFuture<V>
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, TimeUnit unit)
Waits for this future to be completed within the specified time limit without interruption.Throwable
cause()
Returns the cause of the failed I/O operation if the I/O operation has failed.V
getNow()
Return the result without blocking.boolean
isSuccess()
Returnstrue
if and only if the I/O operation was completed successfully.RFuture<V>
removeListener(io.netty.util.concurrent.FutureListener<? super V> listener)
Removes the first occurrence of the specified listener from this future.RFuture<V>
removeListeners(io.netty.util.concurrent.FutureListener<? super V>... listeners)
Removes the first occurrence for each of the listeners from this future.RFuture<V>
sync()
Waits for this future until it is done, and rethrows the cause of the failure if this future failed.RFuture<V>
syncUninterruptibly()
Waits for this future until it is done, and rethrows the cause of the failure if this future failed.
-
-
-
Method Detail
-
isSuccess
boolean isSuccess()
Returnstrue
if and only if the I/O operation was completed successfully.- Returns:
true
if future was completed successfully
-
cause
Throwable cause()
Returns the cause of the failed I/O operation if the I/O operation has failed.- Returns:
- the cause of the failure.
null
if succeeded or this future is not completed yet.
-
getNow
V getNow()
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 withFuture.isDone()
and not relay on the returnednull
value.- Returns:
- object
-
await
boolean await(long timeout, TimeUnit unit) throws InterruptedException
Waits for this future to be completed within the specified time limit.- Parameters:
timeout
- - wait timeoutunit
- - time unit- Returns:
true
if and only if the future was completed within the specified time limit- Throws:
InterruptedException
- if the current thread was interrupted
-
await
boolean await(long timeoutMillis) throws InterruptedException
Waits for this future to be completed within the specified time limit.- Parameters:
timeoutMillis
- - timeout value- Returns:
true
if and only if the future was completed within the specified time limit- Throws:
InterruptedException
- if the current thread was interrupted
-
addListener
RFuture<V> addListener(io.netty.util.concurrent.FutureListener<? super V> listener)
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.- Parameters:
listener
- - listener for future object- Returns:
- Future object
-
addListeners
RFuture<V> addListeners(io.netty.util.concurrent.FutureListener<? super V>... listeners)
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.- Parameters:
listeners
- - listeners for future object- Returns:
- Future object
-
removeListener
RFuture<V> removeListener(io.netty.util.concurrent.FutureListener<? super V> listener)
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.- Parameters:
listener
- - listener for future object- Returns:
- Future object
-
removeListeners
RFuture<V> removeListeners(io.netty.util.concurrent.FutureListener<? super V>... listeners)
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.- Parameters:
listeners
- - listeners for future object- Returns:
- Future object
-
sync
RFuture<V> sync() throws InterruptedException
Waits for this future until it is done, and rethrows the cause of the failure if this future failed.- Returns:
- Future object
- Throws:
InterruptedException
- if the current thread was interrupted
-
syncUninterruptibly
RFuture<V> syncUninterruptibly()
Waits for this future until it is done, and rethrows the cause of the failure if this future failed.- Returns:
- Future object
-
await
RFuture<V> await() throws InterruptedException
Waits for this future to be completed.- Returns:
- Future object
- Throws:
InterruptedException
- if the current thread was interrupted
-
awaitUninterruptibly
RFuture<V> awaitUninterruptibly()
Waits for this future to be completed without interruption. This method catches anInterruptedException
and discards it silently.- Returns:
- Future object
-
awaitUninterruptibly
boolean awaitUninterruptibly(long timeout, TimeUnit unit)
Waits for this future to be completed within the specified time limit without interruption. This method catches anInterruptedException
and discards it silently.- Parameters:
timeout
- - timeout valueunit
- - timeout unit value- Returns:
true
if and only if the future was completed within the specified time limit
-
awaitUninterruptibly
boolean awaitUninterruptibly(long timeoutMillis)
Waits for this future to be completed within the specified time limit without interruption. This method catches anInterruptedException
and discards it silently.- Parameters:
timeoutMillis
- - timeout value- Returns:
true
if and only if the future was completed within the specified time limit
-
-