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
SeeAsyncPromise
andChannelPromise
This 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 AsyncChannelPromise
addListener(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.AsyncChannelPromise
addListeners(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>>... listeners)
AsyncChannelPromise
await()
Wait for this promise to completeAsyncChannelPromise
awaitUninterruptibly()
Wait uninterruptibly for this promise to completeio.netty.channel.Channel
channel()
boolean
isVoid()
AsyncChannelPromise
removeListener(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>> listener)
AsyncChannelPromise
removeListeners(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>>... listeners)
AsyncChannelPromise
setFailure(java.lang.Throwable throwable)
Complete the promise abnormally if not already completeio.netty.channel.ChannelPromise
setSuccess()
AsyncChannelPromise
setSuccess(java.lang.Void v)
Complete the promise successfully if not already completeAsyncChannelPromise
sync()
waits for completion; in case of failure rethrows the original exception without a new wrapping exception so may cause problems for reporting stack tracesAsyncChannelPromise
syncUninterruptibly()
waits for completion; in case of failure rethrows the original exception without a new wrapping exception so may cause problems for reporting stack tracesboolean
trySuccess()
io.netty.channel.ChannelPromise
unvoid()
static AsyncChannelPromise
withListener(io.netty.channel.ChannelHandlerContext context, io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>> listener)
static AsyncChannelPromise
withListener(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.ChannelFuture
writeAndFlush(io.netty.channel.ChannelHandlerContext context, java.lang.Object message)
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)
static io.netty.channel.ChannelFuture
writeAndFlush(io.netty.channel.Channel channel, java.lang.Object message)
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)
-
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:
channel
in interfaceio.netty.channel.ChannelFuture
- Specified by:
channel
in interfaceio.netty.channel.ChannelPromise
-
isVoid
public boolean isVoid()
- Specified by:
isVoid
in interfaceio.netty.channel.ChannelFuture
-
setSuccess
public io.netty.channel.ChannelPromise setSuccess()
- Specified by:
setSuccess
in interfaceio.netty.channel.ChannelPromise
-
setSuccess
public AsyncChannelPromise setSuccess(java.lang.Void v)
Description copied from class:AsyncPromise
Complete the promise successfully if not already complete- Specified by:
setSuccess
in interfaceio.netty.channel.ChannelPromise
- Specified by:
setSuccess
in interfaceio.netty.util.concurrent.Promise<java.lang.Void>
- Specified by:
setSuccess
in interfacePromise<java.lang.Void>
- Overrides:
setSuccess
in classAsyncPromise<java.lang.Void>
-
trySuccess
public boolean trySuccess()
- Specified by:
trySuccess
in interfaceio.netty.channel.ChannelPromise
-
setFailure
public AsyncChannelPromise setFailure(java.lang.Throwable throwable)
Description copied from class:AsyncPromise
Complete the promise abnormally if not already complete- Specified by:
setFailure
in interfaceio.netty.channel.ChannelPromise
- Specified by:
setFailure
in interfaceio.netty.util.concurrent.Promise<java.lang.Void>
- Specified by:
setFailure
in interfacePromise<java.lang.Void>
- Overrides:
setFailure
in classAsyncPromise<java.lang.Void>
-
sync
public AsyncChannelPromise sync() throws java.lang.InterruptedException
Description copied from class:AsyncPromise
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:
sync
in interfaceio.netty.channel.ChannelFuture
- Specified by:
sync
in interfaceio.netty.channel.ChannelPromise
- Specified by:
sync
in interfaceio.netty.util.concurrent.Future<java.lang.Void>
- Specified by:
sync
in interfaceFuture<java.lang.Void>
- Specified by:
sync
in interfaceio.netty.util.concurrent.Promise<java.lang.Void>
- Specified by:
sync
in interfacePromise<java.lang.Void>
- Overrides:
sync
in classAsyncPromise<java.lang.Void>
- Throws:
java.lang.InterruptedException
-
syncUninterruptibly
public AsyncChannelPromise syncUninterruptibly()
Description copied from class:AsyncPromise
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.channel.ChannelFuture
- Specified by:
syncUninterruptibly
in interfaceio.netty.channel.ChannelPromise
- Specified by:
syncUninterruptibly
in interfaceio.netty.util.concurrent.Future<java.lang.Void>
- Specified by:
syncUninterruptibly
in interfaceFuture<java.lang.Void>
- Specified by:
syncUninterruptibly
in interfaceio.netty.util.concurrent.Promise<java.lang.Void>
- Specified by:
syncUninterruptibly
in interfacePromise<java.lang.Void>
- Overrides:
syncUninterruptibly
in classAsyncPromise<java.lang.Void>
-
await
public AsyncChannelPromise await() throws java.lang.InterruptedException
Description copied from class:AsyncPromise
Wait for this promise to complete- Specified by:
await
in interfaceAwaitable
- Specified by:
await
in interfaceio.netty.channel.ChannelFuture
- Specified by:
await
in interfaceio.netty.channel.ChannelPromise
- Specified by:
await
in interfaceio.netty.util.concurrent.Future<java.lang.Void>
- Specified by:
await
in interfaceFuture<java.lang.Void>
- Specified by:
await
in interfaceio.netty.util.concurrent.Promise<java.lang.Void>
- Specified by:
await
in interfacePromise<java.lang.Void>
- Overrides:
await
in classAsyncPromise<java.lang.Void>
- Throws:
java.lang.InterruptedException
- if interrupted
-
awaitUninterruptibly
public AsyncChannelPromise awaitUninterruptibly()
Description copied from class:AsyncPromise
Wait uninterruptibly for this promise to complete- Specified by:
awaitUninterruptibly
in interfaceAwaitable
- Specified by:
awaitUninterruptibly
in interfaceio.netty.channel.ChannelFuture
- Specified by:
awaitUninterruptibly
in interfaceio.netty.channel.ChannelPromise
- Specified by:
awaitUninterruptibly
in interfaceio.netty.util.concurrent.Future<java.lang.Void>
- Specified by:
awaitUninterruptibly
in interfaceFuture<java.lang.Void>
- Specified by:
awaitUninterruptibly
in interfaceio.netty.util.concurrent.Promise<java.lang.Void>
- Specified by:
awaitUninterruptibly
in interfacePromise<java.lang.Void>
- Overrides:
awaitUninterruptibly
in 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:AbstractFuture
Add 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:
addListener
in interfaceio.netty.channel.ChannelFuture
- Specified by:
addListener
in interfaceio.netty.channel.ChannelPromise
- Specified by:
addListener
in interfaceio.netty.util.concurrent.Future<java.lang.Void>
- Specified by:
addListener
in interfaceFuture<java.lang.Void>
- Specified by:
addListener
in interfaceio.netty.util.concurrent.Promise<java.lang.Void>
- Specified by:
addListener
in interfacePromise<java.lang.Void>
- Overrides:
addListener
in 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:
addListeners
in interfaceio.netty.channel.ChannelFuture
- Specified by:
addListeners
in interfaceio.netty.channel.ChannelPromise
- Specified by:
addListeners
in interfaceio.netty.util.concurrent.Future<java.lang.Void>
- Specified by:
addListeners
in interfaceFuture<java.lang.Void>
- Specified by:
addListeners
in interfaceio.netty.util.concurrent.Promise<java.lang.Void>
- Specified by:
addListeners
in interfacePromise<java.lang.Void>
- Overrides:
addListeners
in 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:
removeListener
in interfaceio.netty.channel.ChannelFuture
- Specified by:
removeListener
in interfaceio.netty.channel.ChannelPromise
- Specified by:
removeListener
in interfaceio.netty.util.concurrent.Future<java.lang.Void>
- Specified by:
removeListener
in interfaceFuture<java.lang.Void>
- Specified by:
removeListener
in interfaceio.netty.util.concurrent.Promise<java.lang.Void>
- Specified by:
removeListener
in interfacePromise<java.lang.Void>
- Overrides:
removeListener
in 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:
removeListeners
in interfaceio.netty.channel.ChannelFuture
- Specified by:
removeListeners
in interfaceio.netty.channel.ChannelPromise
- Specified by:
removeListeners
in interfaceio.netty.util.concurrent.Future<java.lang.Void>
- Specified by:
removeListeners
in interfaceFuture<java.lang.Void>
- Specified by:
removeListeners
in interfaceio.netty.util.concurrent.Promise<java.lang.Void>
- Specified by:
removeListeners
in interfacePromise<java.lang.Void>
- Overrides:
removeListeners
in classAsyncPromise<java.lang.Void>
-
unvoid
public io.netty.channel.ChannelPromise unvoid()
- Specified by:
unvoid
in interfaceio.netty.channel.ChannelPromise
-
-