public class PromiseDelegator<T> extends Object implements RPromise<T>
Constructor and Description |
---|
PromiseDelegator(RPromise<T> promise) |
Modifier and Type | Method and 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.
|
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.
|
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,
TimeUnit unit)
Waits for this future to be completed within the
specified time limit without interruption.
|
boolean |
cancel(boolean mayInterruptIfRunning) |
Throwable |
cause()
Returns the cause of the failed I/O operation if the I/O operation has
failed.
|
T |
get() |
T |
get(long timeout,
TimeUnit unit) |
RPromise<T> |
getInnerPromise() |
T |
getNow()
Return the result without blocking.
|
boolean |
hasListeners() |
boolean |
isCancelled() |
boolean |
isDone() |
boolean |
isSuccess()
Returns
true if and only if the I/O operation was completed
successfully. |
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.
|
public boolean isSuccess()
RFuture
true
if and only if the I/O operation was completed
successfully.public boolean trySuccess(T result)
RPromise
trySuccess
in interface RPromise<T>
result
- objecttrue
if and only if successfully marked this future as
a success. Otherwise false
because this future is
already marked as either a success or a failure.public Throwable cause()
RFuture
public boolean tryFailure(Throwable cause)
RPromise
tryFailure
in interface RPromise<T>
cause
- objecttrue
if and only if successfully marked this future as
a failure. Otherwise false
because this future is
already marked as either a success or a failure.public boolean setUncancellable()
RPromise
setUncancellable
in interface RPromise<T>
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.public RPromise<T> addListener(io.netty.util.concurrent.FutureListener<? super T> listener)
RFuture
addListener
in interface RFuture<T>
addListener
in interface RPromise<T>
listener
- - listener for future objectpublic RPromise<T> addListeners(io.netty.util.concurrent.FutureListener<? super T>... listeners)
RFuture
addListeners
in interface RFuture<T>
addListeners
in interface RPromise<T>
listeners
- - listeners for future objectpublic RPromise<T> removeListener(io.netty.util.concurrent.FutureListener<? super T> listener)
RFuture
removeListener
in interface RFuture<T>
removeListener
in interface RPromise<T>
listener
- - listener for future objectpublic RPromise<T> removeListeners(io.netty.util.concurrent.FutureListener<? super T>... listeners)
RFuture
removeListeners
in interface RFuture<T>
removeListeners
in interface RPromise<T>
listeners
- - listeners for future objectpublic RPromise<T> await() throws InterruptedException
RFuture
public RPromise<T> awaitUninterruptibly()
RFuture
InterruptedException
and
discards it silently.awaitUninterruptibly
in interface RFuture<T>
awaitUninterruptibly
in interface RPromise<T>
public RPromise<T> sync() throws InterruptedException
RFuture
public RPromise<T> syncUninterruptibly()
RFuture
syncUninterruptibly
in interface RFuture<T>
syncUninterruptibly
in interface RPromise<T>
public boolean await(long timeout, TimeUnit unit) throws InterruptedException
RFuture
await
in interface RFuture<T>
timeout
- - wait timeoutunit
- - time unittrue
if and only if the future was completed within
the specified time limitInterruptedException
- if the current thread was interruptedpublic boolean isCancelled()
isCancelled
in interface Future<T>
public boolean await(long timeoutMillis) throws InterruptedException
RFuture
await
in interface RFuture<T>
timeoutMillis
- - timeout valuetrue
if and only if the future was completed within
the specified time limitInterruptedException
- if the current thread was interruptedpublic T get() throws InterruptedException, ExecutionException
get
in interface Future<T>
InterruptedException
ExecutionException
public boolean awaitUninterruptibly(long timeout, TimeUnit unit)
RFuture
InterruptedException
and discards it silently.awaitUninterruptibly
in interface RFuture<T>
timeout
- - timeout valueunit
- - timeout unit valuetrue
if and only if the future was completed within
the specified time limitpublic T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<T>
InterruptedException
ExecutionException
TimeoutException
public boolean awaitUninterruptibly(long timeoutMillis)
RFuture
InterruptedException
and discards it silently.awaitUninterruptibly
in interface RFuture<T>
timeoutMillis
- - timeout valuetrue
if and only if the future was completed within
the specified time limitpublic T getNow()
RFuture
null
.
As it is possible that a null
value is used to mark the future as successful you also need to check
if the future is really done with Future.isDone()
and not relay on the returned null
value.public boolean cancel(boolean mayInterruptIfRunning)
public boolean hasListeners()
hasListeners
in interface RPromise<T>
Copyright © 2014–2018 The Redisson Project. All rights reserved.