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 integratesPromisewith ourFutureAPI 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 completebooleansetUncancellableExclusive()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:FutureSupportFutures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor)natively- Specified by:
addCallbackin interfaceFuture<V>
-
addCallback
Promise<V> addCallback(com.google.common.util.concurrent.FutureCallback<? super V> callback, java.util.concurrent.Executor executor)
Description copied from interface:FutureSupportFutures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor)natively- Specified by:
addCallbackin 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:FutureSupportFutures.addCallback(com.google.common.util.concurrent.ListenableFuture<V>, com.google.common.util.concurrent.FutureCallback<? super V>, java.util.concurrent.Executor)natively- Specified by:
addCallbackin interfaceFuture<V>
-
addListener
Promise<V> addListener(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>> var1)
- Specified by:
addListenerin interfaceio.netty.util.concurrent.Future<V>- Specified by:
addListenerin interfaceFuture<V>- Specified by:
addListenerin 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:
addListenersin interfaceio.netty.util.concurrent.Future<V>- Specified by:
addListenersin interfaceFuture<V>- Specified by:
addListenersin 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:
removeListenerin interfaceio.netty.util.concurrent.Future<V>- Specified by:
removeListenerin interfaceFuture<V>- Specified by:
removeListenerin 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:
removeListenersin interfaceio.netty.util.concurrent.Future<V>- Specified by:
removeListenersin interfaceFuture<V>- Specified by:
removeListenersin 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:
setSuccessin 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:
setFailurein 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:
awaitUninterruptiblyin interfaceAwaitable- Specified by:
awaitUninterruptiblyin interfaceio.netty.util.concurrent.Future<V>- Specified by:
awaitUninterruptiblyin interfaceFuture<V>- Specified by:
awaitUninterruptiblyin 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:
awaitThrowUncheckedOnInterruptin interfaceAwaitable- Specified by:
awaitThrowUncheckedOnInterruptin 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:
syncUninterruptiblyin interfaceio.netty.util.concurrent.Future<V>- Specified by:
syncUninterruptiblyin interfaceFuture<V>- Specified by:
syncUninterruptiblyin interfaceio.netty.util.concurrent.Promise<V>
-
-