T
- type of objectpublic class RedissonPromise<T> extends CompletableFuture<T> implements RPromise<T>
CompletableFuture.AsynchronousCompletionTask
Constructor and Description |
---|
RedissonPromise() |
Modifier and Type | Method and Description |
---|---|
RPromise<T> |
addListener(io.netty.util.concurrent.FutureListener<? super T> listener)
Use methods from
CompletionStage interface |
RPromise<T> |
addListeners(io.netty.util.concurrent.FutureListener<? super T>... listeners)
Use methods from
CompletionStage interface |
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 |
getNow()
Return the result without blocking.
|
boolean |
hasListeners() |
boolean |
isSuccess()
Returns
true if and only if the I/O operation was completed
successfully. |
static <V> RFuture<V> |
newFailedFuture(Throwable cause) |
static <V> RFuture<V> |
newSucceededFuture(V result) |
RPromise<T> |
removeListener(io.netty.util.concurrent.FutureListener<? super T> listener) |
RPromise<T> |
removeListeners(io.netty.util.concurrent.FutureListener<? super T>... listeners) |
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.
|
acceptEither, acceptEitherAsync, acceptEitherAsync, allOf, anyOf, applyToEither, applyToEitherAsync, applyToEitherAsync, complete, completedFuture, completeExceptionally, exceptionally, get, get, getNow, getNumberOfDependents, handle, handleAsync, handleAsync, isCancelled, isCompletedExceptionally, isDone, join, obtrudeException, obtrudeValue, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, runAsync, runAsync, supplyAsync, supplyAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, toString, whenComplete, whenCompleteAsync, whenCompleteAsync
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
get, get, isCancelled, isDone
acceptEither, acceptEitherAsync, acceptEitherAsync, applyToEither, applyToEitherAsync, applyToEitherAsync, exceptionally, handle, handleAsync, handleAsync, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, whenComplete, whenCompleteAsync, whenCompleteAsync
public static <V> RFuture<V> newSucceededFuture(V result)
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
CompletionStage
interfaceaddListener
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
CompletionStage
interfaceaddListeners
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)
removeListener
in interface RFuture<T>
removeListener
in interface RPromise<T>
public RPromise<T> removeListeners(io.netty.util.concurrent.FutureListener<? super T>... listeners)
removeListeners
in interface RFuture<T>
removeListeners
in interface RPromise<T>
public 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 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 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 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.