Interface Promise<V>
-
- All Superinterfaces:
Awaitable
,io.netty.util.concurrent.Future<V>
,java.util.concurrent.Future<V>
,Future<V>
,com.google.common.util.concurrent.ListenableFuture<V>
,io.netty.util.concurrent.Promise<V>
- All Known Implementing Classes:
AsyncChannelPromise
,AsyncOneResponse
,AsyncPromise
,AsyncPromise.WithExecutor
,SyncPromise
,SyncPromise.WithExecutor
public interface Promise<V> extends io.netty.util.concurrent.Promise<V>, Future<V>
A Promise that integratesPromise
with ourFuture
API to improve clarity and coherence in the codebase.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.cassandra.utils.concurrent.Awaitable
Awaitable.AbstractAwaitable, Awaitable.AsyncAwaitable, Awaitable.Defaults, Awaitable.SyncAwaitable
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description Promise<V>
addCallback(com.google.common.util.concurrent.FutureCallback<? super V> callback)
SupportFutures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor)
nativelyPromise<V>
addCallback(com.google.common.util.concurrent.FutureCallback<? super V> callback, java.util.concurrent.Executor executor)
SupportFutures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor)
nativelyPromise<V>
addCallback(java.util.function.Consumer<? super V> onSuccess, java.util.function.Consumer<? super java.lang.Throwable> onFailure)
SupportFutures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor)
nativelyPromise<V>
addListener(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>> var1)
Promise<V>
addListeners(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>>... var1)
Promise<V>
await()
Wait indefinitely for this promise to complete, throwing any interruptPromise<V>
awaitThrowUncheckedOnInterrupt()
Wait indefinitely for this promise to complete, throwing any interrupt as an UncheckedInterruptedExceptionPromise<V>
awaitUninterruptibly()
Wait indefinitely for this promise to completestatic <V> io.netty.util.concurrent.GenericFutureListener<? extends Future<V>>
listener(com.google.common.util.concurrent.FutureCallback<V> callback)
static <V> io.netty.util.concurrent.GenericFutureListener<? extends Future<V>>
listener(java.util.concurrent.ExecutorService executor, com.google.common.util.concurrent.FutureCallback<V> callback)
Promise<V>
removeListener(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>> var1)
Promise<V>
removeListeners(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>>... var1)
Promise<V>
setFailure(java.lang.Throwable throwable)
Complete the promise abnormally if not already completePromise<V>
setSuccess(V v)
Complete the promise successfully if not already completeboolean
setUncancellableExclusive()
Prevent a future caller from cancelling this promisePromise<V>
sync()
waits for completion; in case of failure rethrows the original exception without a new wrapping exception so may cause problems for reporting stack tracesPromise<V>
syncUninterruptibly()
waits for completion; in case of failure rethrows the original exception without a new wrapping exception so may cause problems for reporting stack traces-
Methods inherited from interface org.apache.cassandra.utils.concurrent.Awaitable
await, awaitThrowUncheckedOnInterrupt, awaitUninterruptibly, awaitUntil, awaitUntilThrowUncheckedOnInterrupt, awaitUntilUninterruptibly
-
Methods inherited from interface io.netty.util.concurrent.Future
await, awaitUninterruptibly, cancel, cause, getNow, isCancellable, isSuccess
-
Methods inherited from interface org.apache.cassandra.utils.concurrent.Future
addCallback, addCallback, addCallback, addListener, addListener, await, awaitUninterruptibly, flatMap, flatMap, map, map, notifyExecutor, rethrowIfFailed, syncThrowUncheckedOnInterrupt
-
-
-
-
Method Detail
-
listener
static <V> io.netty.util.concurrent.GenericFutureListener<? extends Future<V>> listener(com.google.common.util.concurrent.FutureCallback<V> callback)
-
listener
static <V> io.netty.util.concurrent.GenericFutureListener<? extends Future<V>> listener(java.util.concurrent.ExecutorService executor, com.google.common.util.concurrent.FutureCallback<V> callback)
-
addCallback
Promise<V> addCallback(com.google.common.util.concurrent.FutureCallback<? super V> callback)
Description copied from interface:Future
SupportFutures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor)
natively- Specified by:
addCallback
in interfaceFuture<V>
-
addCallback
Promise<V> addCallback(com.google.common.util.concurrent.FutureCallback<? super V> callback, java.util.concurrent.Executor executor)
Description copied from interface:Future
SupportFutures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor)
natively- Specified by:
addCallback
in interfaceFuture<V>
-
addCallback
Promise<V> addCallback(java.util.function.Consumer<? super V> onSuccess, java.util.function.Consumer<? super java.lang.Throwable> onFailure)
Description copied from interface:Future
SupportFutures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor)
natively- Specified by:
addCallback
in interfaceFuture<V>
-
addListener
Promise<V> addListener(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>> var1)
- Specified by:
addListener
in interfaceio.netty.util.concurrent.Future<V>
- Specified by:
addListener
in interfaceFuture<V>
- Specified by:
addListener
in interfaceio.netty.util.concurrent.Promise<V>
-
addListeners
Promise<V> addListeners(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>>... var1)
- Specified by:
addListeners
in interfaceio.netty.util.concurrent.Future<V>
- Specified by:
addListeners
in interfaceFuture<V>
- Specified by:
addListeners
in interfaceio.netty.util.concurrent.Promise<V>
-
removeListener
Promise<V> removeListener(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>> var1)
- Specified by:
removeListener
in interfaceio.netty.util.concurrent.Future<V>
- Specified by:
removeListener
in interfaceFuture<V>
- Specified by:
removeListener
in interfaceio.netty.util.concurrent.Promise<V>
-
removeListeners
Promise<V> removeListeners(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>>... var1)
- Specified by:
removeListeners
in interfaceio.netty.util.concurrent.Future<V>
- Specified by:
removeListeners
in interfaceFuture<V>
- Specified by:
removeListeners
in interfaceio.netty.util.concurrent.Promise<V>
-
setSuccess
Promise<V> setSuccess(V v) throws java.lang.IllegalStateException
Complete the promise successfully if not already complete- Specified by:
setSuccess
in interfaceio.netty.util.concurrent.Promise<V>
- Throws:
java.lang.IllegalStateException
- if already set
-
setFailure
Promise<V> setFailure(java.lang.Throwable throwable) throws java.lang.IllegalStateException
Complete the promise abnormally if not already complete- Specified by:
setFailure
in interfaceio.netty.util.concurrent.Promise<V>
- Throws:
java.lang.IllegalStateException
- if already set
-
setUncancellableExclusive
boolean setUncancellableExclusive()
Prevent a future caller from cancelling this promise- Returns:
- true iff this invocation set it to uncancellable, whether or not now uncancellable
-
await
Promise<V> await() throws java.lang.InterruptedException
Wait indefinitely for this promise to complete, throwing any interrupt
-
awaitUninterruptibly
Promise<V> awaitUninterruptibly()
Wait indefinitely for this promise to complete- Specified by:
awaitUninterruptibly
in interfaceAwaitable
- Specified by:
awaitUninterruptibly
in interfaceio.netty.util.concurrent.Future<V>
- Specified by:
awaitUninterruptibly
in interfaceFuture<V>
- Specified by:
awaitUninterruptibly
in interfaceio.netty.util.concurrent.Promise<V>
-
awaitThrowUncheckedOnInterrupt
Promise<V> awaitThrowUncheckedOnInterrupt()
Wait indefinitely for this promise to complete, throwing any interrupt as an UncheckedInterruptedException- Specified by:
awaitThrowUncheckedOnInterrupt
in interfaceAwaitable
- Specified by:
awaitThrowUncheckedOnInterrupt
in interfaceFuture<V>
- Throws:
UncheckedInterruptedException
- if interrupted
-
sync
Promise<V> sync() throws java.lang.InterruptedException
waits for completion; in case of failure rethrows the original exception without a new wrapping exception so may cause problems for reporting stack traces
-
syncUninterruptibly
Promise<V> syncUninterruptibly()
waits for completion; in case of failure rethrows the original exception without a new wrapping exception so may cause problems for reporting stack traces- Specified by:
syncUninterruptibly
in interfaceio.netty.util.concurrent.Future<V>
- Specified by:
syncUninterruptibly
in interfaceFuture<V>
- Specified by:
syncUninterruptibly
in interfaceio.netty.util.concurrent.Promise<V>
-
-