Package org.apache.cassandra.net
Class AsyncChannelPromise
- java.lang.Object
-
- org.apache.cassandra.utils.concurrent.AbstractFuture<V>
-
- org.apache.cassandra.utils.concurrent.AsyncFuture<V>
-
- org.apache.cassandra.utils.concurrent.AsyncPromise<V>
-
- org.apache.cassandra.utils.concurrent.AsyncPromise.WithExecutor<java.lang.Void>
-
- org.apache.cassandra.net.AsyncChannelPromise
-
- All Implemented Interfaces:
com.google.common.util.concurrent.ListenableFuture<java.lang.Void>,io.netty.channel.ChannelFuture,io.netty.channel.ChannelPromise,io.netty.util.concurrent.Future<java.lang.Void>,io.netty.util.concurrent.Promise<java.lang.Void>,java.util.concurrent.Future<java.lang.Void>,Awaitable,Future<java.lang.Void>,Promise<java.lang.Void>
public class AsyncChannelPromise extends AsyncPromise.WithExecutor<java.lang.Void> implements io.netty.channel.ChannelPromise
SeeAsyncPromiseandChannelPromiseThis class is all boiler plate, just ensuring we return ourselves and invoke the correct Promise method.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.cassandra.utils.concurrent.AsyncPromise
AsyncPromise.WithExecutor<V>
-
Nested classes/interfaces inherited from interface org.apache.cassandra.utils.concurrent.Awaitable
Awaitable.AbstractAwaitable, Awaitable.AsyncAwaitable, Awaitable.Defaults, Awaitable.SyncAwaitable
-
-
Field Summary
-
Fields inherited from class org.apache.cassandra.utils.concurrent.AbstractFuture
CANCELLED, UNCANCELLABLE, UNSET
-
-
Constructor Summary
Constructors Constructor Description AsyncChannelPromise(io.netty.channel.Channel channel)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AsyncChannelPromiseaddListener(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>> listener)Add a listener to be invoked once this future completes.AsyncChannelPromiseaddListeners(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>>... listeners)AsyncChannelPromiseawait()Wait for this promise to completeAsyncChannelPromiseawaitUninterruptibly()Wait uninterruptibly for this promise to completeio.netty.channel.Channelchannel()booleanisVoid()AsyncChannelPromiseremoveListener(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>> listener)AsyncChannelPromiseremoveListeners(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>>... listeners)AsyncChannelPromisesetFailure(java.lang.Throwable throwable)Complete the promise abnormally if not already completeio.netty.channel.ChannelPromisesetSuccess()AsyncChannelPromisesetSuccess(java.lang.Void v)Complete the promise successfully if not already completeAsyncChannelPromisesync()waits for completion; in case of failure rethrows the original exception without a new wrapping exception so may cause problems for reporting stack tracesAsyncChannelPromisesyncUninterruptibly()waits for completion; in case of failure rethrows the original exception without a new wrapping exception so may cause problems for reporting stack tracesbooleantrySuccess()io.netty.channel.ChannelPromiseunvoid()static AsyncChannelPromisewithListener(io.netty.channel.ChannelHandlerContext context, io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>> listener)static AsyncChannelPromisewithListener(io.netty.channel.Channel channel, io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>> listener)static io.netty.channel.ChannelFuturewriteAndFlush(io.netty.channel.ChannelHandlerContext context, java.lang.Object message)static io.netty.channel.ChannelFuturewriteAndFlush(io.netty.channel.ChannelHandlerContext context, java.lang.Object message, io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>> listener)static io.netty.channel.ChannelFuturewriteAndFlush(io.netty.channel.Channel channel, java.lang.Object message)static io.netty.channel.ChannelFuturewriteAndFlush(io.netty.channel.Channel channel, java.lang.Object message, io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>> listener)-
Methods inherited from class org.apache.cassandra.utils.concurrent.AsyncPromise.WithExecutor
notifyExecutor
-
Methods inherited from class org.apache.cassandra.utils.concurrent.AsyncPromise
addCallback, addCallback, addCallback, awaitThrowUncheckedOnInterrupt, isUncancellable, setUncancellable, setUncancellableExclusive, tryFailure, trySuccess, uncancellable, uncancellable, uncancellable, withExecutor
-
Methods inherited from class org.apache.cassandra.utils.concurrent.AsyncFuture
awaitUntil, flatMap, map
-
Methods inherited from class org.apache.cassandra.utils.concurrent.AbstractFuture
addCallback, addCallback, addCallback, addListener, addListener, await, awaitThrowUncheckedOnInterrupt, awaitUninterruptibly, awaitUntilThrowUncheckedOnInterrupt, awaitUntilUninterruptibly, cancel, cause, description, flatMap, get, get, getNow, getWhenDone, isCancellable, isCancelled, isDone, isSuccess, map, map, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
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, rethrowIfFailed, syncThrowUncheckedOnInterrupt
-
-
-
-
Method Detail
-
withListener
public static AsyncChannelPromise withListener(io.netty.channel.ChannelHandlerContext context, io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>> listener)
-
withListener
public static AsyncChannelPromise withListener(io.netty.channel.Channel channel, io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>> listener)
-
writeAndFlush
public static io.netty.channel.ChannelFuture writeAndFlush(io.netty.channel.ChannelHandlerContext context, java.lang.Object message, io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>> listener)
-
writeAndFlush
public static io.netty.channel.ChannelFuture writeAndFlush(io.netty.channel.Channel channel, java.lang.Object message, io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>> listener)
-
writeAndFlush
public static io.netty.channel.ChannelFuture writeAndFlush(io.netty.channel.ChannelHandlerContext context, java.lang.Object message)
-
writeAndFlush
public static io.netty.channel.ChannelFuture writeAndFlush(io.netty.channel.Channel channel, java.lang.Object message)
-
channel
public io.netty.channel.Channel channel()
- Specified by:
channelin interfaceio.netty.channel.ChannelFuture- Specified by:
channelin interfaceio.netty.channel.ChannelPromise
-
isVoid
public boolean isVoid()
- Specified by:
isVoidin interfaceio.netty.channel.ChannelFuture
-
setSuccess
public io.netty.channel.ChannelPromise setSuccess()
- Specified by:
setSuccessin interfaceio.netty.channel.ChannelPromise
-
setSuccess
public AsyncChannelPromise setSuccess(java.lang.Void v)
Description copied from class:AsyncPromiseComplete the promise successfully if not already complete- Specified by:
setSuccessin interfaceio.netty.channel.ChannelPromise- Specified by:
setSuccessin interfaceio.netty.util.concurrent.Promise<java.lang.Void>- Specified by:
setSuccessin interfacePromise<java.lang.Void>- Overrides:
setSuccessin classAsyncPromise<java.lang.Void>
-
trySuccess
public boolean trySuccess()
- Specified by:
trySuccessin interfaceio.netty.channel.ChannelPromise
-
setFailure
public AsyncChannelPromise setFailure(java.lang.Throwable throwable)
Description copied from class:AsyncPromiseComplete the promise abnormally if not already complete- Specified by:
setFailurein interfaceio.netty.channel.ChannelPromise- Specified by:
setFailurein interfaceio.netty.util.concurrent.Promise<java.lang.Void>- Specified by:
setFailurein interfacePromise<java.lang.Void>- Overrides:
setFailurein classAsyncPromise<java.lang.Void>
-
sync
public AsyncChannelPromise sync() throws java.lang.InterruptedException
Description copied from class:AsyncPromisewaits 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:
syncin interfaceio.netty.channel.ChannelFuture- Specified by:
syncin interfaceio.netty.channel.ChannelPromise- Specified by:
syncin interfaceio.netty.util.concurrent.Future<java.lang.Void>- Specified by:
syncin interfaceFuture<java.lang.Void>- Specified by:
syncin interfaceio.netty.util.concurrent.Promise<java.lang.Void>- Specified by:
syncin interfacePromise<java.lang.Void>- Overrides:
syncin classAsyncPromise<java.lang.Void>- Throws:
java.lang.InterruptedException
-
syncUninterruptibly
public AsyncChannelPromise syncUninterruptibly()
Description copied from class:AsyncPromisewaits 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.channel.ChannelFuture- Specified by:
syncUninterruptiblyin interfaceio.netty.channel.ChannelPromise- Specified by:
syncUninterruptiblyin interfaceio.netty.util.concurrent.Future<java.lang.Void>- Specified by:
syncUninterruptiblyin interfaceFuture<java.lang.Void>- Specified by:
syncUninterruptiblyin interfaceio.netty.util.concurrent.Promise<java.lang.Void>- Specified by:
syncUninterruptiblyin interfacePromise<java.lang.Void>- Overrides:
syncUninterruptiblyin classAsyncPromise<java.lang.Void>
-
await
public AsyncChannelPromise await() throws java.lang.InterruptedException
Description copied from class:AsyncPromiseWait for this promise to complete- Specified by:
awaitin interfaceAwaitable- Specified by:
awaitin interfaceio.netty.channel.ChannelFuture- Specified by:
awaitin interfaceio.netty.channel.ChannelPromise- Specified by:
awaitin interfaceio.netty.util.concurrent.Future<java.lang.Void>- Specified by:
awaitin interfaceFuture<java.lang.Void>- Specified by:
awaitin interfaceio.netty.util.concurrent.Promise<java.lang.Void>- Specified by:
awaitin interfacePromise<java.lang.Void>- Overrides:
awaitin classAsyncPromise<java.lang.Void>- Throws:
java.lang.InterruptedException- if interrupted
-
awaitUninterruptibly
public AsyncChannelPromise awaitUninterruptibly()
Description copied from class:AsyncPromiseWait uninterruptibly for this promise to complete- Specified by:
awaitUninterruptiblyin interfaceAwaitable- Specified by:
awaitUninterruptiblyin interfaceio.netty.channel.ChannelFuture- Specified by:
awaitUninterruptiblyin interfaceio.netty.channel.ChannelPromise- Specified by:
awaitUninterruptiblyin interfaceio.netty.util.concurrent.Future<java.lang.Void>- Specified by:
awaitUninterruptiblyin interfaceFuture<java.lang.Void>- Specified by:
awaitUninterruptiblyin interfaceio.netty.util.concurrent.Promise<java.lang.Void>- Specified by:
awaitUninterruptiblyin interfacePromise<java.lang.Void>- Overrides:
awaitUninterruptiblyin classAsyncPromise<java.lang.Void>
-
addListener
public AsyncChannelPromise addListener(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>> listener)
Description copied from class:AbstractFutureAdd a listener to be invoked once this future completes. Listeners are submitted toAbstractFuture.notifyExecutor()in the order they are added (or the specified executor in the case ofAbstractFuture.addListener(Runnable, Executor). ifAbstractFuture.notifyExecutor()is unset, they are invoked in the order they are added. The ordering holds across all variants of this method.- Specified by:
addListenerin interfaceio.netty.channel.ChannelFuture- Specified by:
addListenerin interfaceio.netty.channel.ChannelPromise- Specified by:
addListenerin interfaceio.netty.util.concurrent.Future<java.lang.Void>- Specified by:
addListenerin interfaceFuture<java.lang.Void>- Specified by:
addListenerin interfaceio.netty.util.concurrent.Promise<java.lang.Void>- Specified by:
addListenerin interfacePromise<java.lang.Void>- Overrides:
addListenerin classAsyncPromise<java.lang.Void>
-
addListeners
public AsyncChannelPromise addListeners(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>>... listeners)
- Specified by:
addListenersin interfaceio.netty.channel.ChannelFuture- Specified by:
addListenersin interfaceio.netty.channel.ChannelPromise- Specified by:
addListenersin interfaceio.netty.util.concurrent.Future<java.lang.Void>- Specified by:
addListenersin interfaceFuture<java.lang.Void>- Specified by:
addListenersin interfaceio.netty.util.concurrent.Promise<java.lang.Void>- Specified by:
addListenersin interfacePromise<java.lang.Void>- Overrides:
addListenersin classAsyncPromise<java.lang.Void>
-
removeListener
public AsyncChannelPromise removeListener(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>> listener)
- Specified by:
removeListenerin interfaceio.netty.channel.ChannelFuture- Specified by:
removeListenerin interfaceio.netty.channel.ChannelPromise- Specified by:
removeListenerin interfaceio.netty.util.concurrent.Future<java.lang.Void>- Specified by:
removeListenerin interfaceFuture<java.lang.Void>- Specified by:
removeListenerin interfaceio.netty.util.concurrent.Promise<java.lang.Void>- Specified by:
removeListenerin interfacePromise<java.lang.Void>- Overrides:
removeListenerin classAsyncPromise<java.lang.Void>
-
removeListeners
public AsyncChannelPromise removeListeners(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>>... listeners)
- Specified by:
removeListenersin interfaceio.netty.channel.ChannelFuture- Specified by:
removeListenersin interfaceio.netty.channel.ChannelPromise- Specified by:
removeListenersin interfaceio.netty.util.concurrent.Future<java.lang.Void>- Specified by:
removeListenersin interfaceFuture<java.lang.Void>- Specified by:
removeListenersin interfaceio.netty.util.concurrent.Promise<java.lang.Void>- Specified by:
removeListenersin interfacePromise<java.lang.Void>- Overrides:
removeListenersin classAsyncPromise<java.lang.Void>
-
unvoid
public io.netty.channel.ChannelPromise unvoid()
- Specified by:
unvoidin interfaceio.netty.channel.ChannelPromise
-
-