Class DefaultChannelProgressivePromise
java.lang.Object
io.netty.util.concurrent.AbstractFuture<Void>
io.netty.util.concurrent.DefaultPromise<Void>
io.netty.util.concurrent.DefaultProgressivePromise<Void>
io.netty.channel.DefaultChannelProgressivePromise
- All Implemented Interfaces:
ChannelFuture, ChannelProgressiveFuture, ChannelProgressivePromise, ChannelPromise, Future<Void>, ProgressiveFuture<Void>, ProgressivePromise<Void>, Promise<Void>, Future<Void>
public class DefaultChannelProgressivePromise
extends DefaultProgressivePromise<Void>
implements ChannelProgressivePromise
The default
ChannelProgressivePromise implementation. It is recommended to use
Channel.newProgressivePromise() to create a new ChannelProgressivePromise rather than calling the
constructor explicitly.-
Field Summary
Fields inherited from class DefaultPromise
PROPERTY_MAX_LISTENER_STACK_DEPTH -
Constructor Summary
ConstructorsConstructorDescriptionDefaultChannelProgressivePromise(Channel channel) Creates a new instance.DefaultChannelProgressivePromise(Channel channel, EventExecutor executor) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionaddListener(GenericFutureListener<? extends Future<? super Void>> listener) Adds the specified listener to this future.addListeners(GenericFutureListener<? extends Future<? super Void>>... listeners) Adds the specified listeners to this future.await()Waits for this future to be completed.Waits for this future to be completed without interruption.channel()Returns a channel where the I/O operation associated with this future takes place.protected voidprotected EventExecutorexecutor()Get the executor used to notify listeners when this promise is complete.longvoidflushCheckpoint(long checkpoint) booleanisVoid()Returnstrueif thisChannelFutureis a void future and so not allow to call any of the following methods:ChannelFuture.addListener(GenericFutureListener)ChannelFuture.addListeners(GenericFutureListener[])ChannelFuture.await()Future.await(long, TimeUnit)()}Future.await(long)()}ChannelFuture.awaitUninterruptibly()ChannelFuture.sync()ChannelFuture.syncUninterruptibly()promise()removeListener(GenericFutureListener<? extends Future<? super Void>> listener) Removes the first occurrence of the specified listener from this future.removeListeners(GenericFutureListener<? extends Future<? super Void>>... listeners) Removes the first occurrence for each of the listeners from this future.setFailure(Throwable cause) Marks this future as a failure and notifies all listeners.setProgress(long progress, long total) Sets the current progress of the operation and notifies the listeners that implementGenericProgressiveFutureListener.setSuccess(Void result) Marks this future as a success and notifies all listeners.sync()Waits for this future until it is done, and rethrows the cause of the failure if this future failed.Waits for this future until it is done, and rethrows the cause of the failure if this future failed.booleanunvoid()Methods inherited from class DefaultProgressivePromise
tryProgressMethods inherited from class DefaultPromise
await, await, awaitUninterruptibly, awaitUninterruptibly, cancel, cause, get, get, getNow, isCancellable, isCancelled, isDone, isSuccess, notifyListener, setUncancellable, toString, toStringBuilder, tryFailure, trySuccessMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Future
await, await, awaitUninterruptibly, awaitUninterruptibly, cancel, cause, getNow, isCancellable, isSuccessMethods inherited from interface Future
get, get, isCancelled, isDoneMethods inherited from interface ProgressivePromise
tryProgressMethods inherited from interface Promise
setUncancellable, tryFailure, trySuccess
-
Constructor Details
-
DefaultChannelProgressivePromise
-
DefaultChannelProgressivePromise
Creates a new instance.- Parameters:
channel- theChannelassociated with this future
-
-
Method Details
-
executor
Description copied from class:DefaultPromiseGet the executor used to notify listeners when this promise is complete.It is assumed this executor will protect against
StackOverflowErrorexceptions. The executor may be used to avoidStackOverflowErrorby executing aRunnableif the stack depth exceeds a threshold.- Overrides:
executorin classDefaultPromise<Void>- Returns:
- The executor used to notify listeners when this promise is complete.
-
channel
Description copied from interface:ChannelFutureReturns a channel where the I/O operation associated with this future takes place.- Specified by:
channelin interfaceChannelFuture- Specified by:
channelin interfaceChannelPromise
-
setSuccess
- Specified by:
setSuccessin interfaceChannelProgressivePromise- Specified by:
setSuccessin interfaceChannelPromise
-
setSuccess
Description copied from interface:PromiseMarks this future as a success and notifies all listeners. If it is success or failed already it will throw anIllegalStateException.- Specified by:
setSuccessin interfaceChannelProgressivePromise- Specified by:
setSuccessin interfaceChannelPromise- Specified by:
setSuccessin interfaceProgressivePromise<Void>- Specified by:
setSuccessin interfacePromise<Void>- Overrides:
setSuccessin classDefaultProgressivePromise<Void>
-
trySuccess
public boolean trySuccess()- Specified by:
trySuccessin interfaceChannelPromise
-
setFailure
Description copied from interface:PromiseMarks this future as a failure and notifies all listeners. If it is success or failed already it will throw anIllegalStateException.- Specified by:
setFailurein interfaceChannelProgressivePromise- Specified by:
setFailurein interfaceChannelPromise- Specified by:
setFailurein interfaceProgressivePromise<Void>- Specified by:
setFailurein interfacePromise<Void>- Overrides:
setFailurein classDefaultProgressivePromise<Void>
-
setProgress
Description copied from interface:ProgressivePromiseSets the current progress of the operation and notifies the listeners that implementGenericProgressiveFutureListener.- Specified by:
setProgressin interfaceChannelProgressivePromise- Specified by:
setProgressin interfaceProgressivePromise<Void>- Overrides:
setProgressin classDefaultProgressivePromise<Void>
-
addListener
public ChannelProgressivePromise addListener(GenericFutureListener<? extends Future<? super Void>> listener) Description copied from interface:FutureAdds the specified listener to this future. The specified listener is notified when this future is done. If this future is already completed, the specified listener is notified immediately.- Specified by:
addListenerin interfaceChannelFuture- Specified by:
addListenerin interfaceChannelProgressiveFuture- Specified by:
addListenerin interfaceChannelProgressivePromise- Specified by:
addListenerin interfaceChannelPromise- Specified by:
addListenerin interfaceFuture<Void>- Specified by:
addListenerin interfaceProgressiveFuture<Void>- Specified by:
addListenerin interfaceProgressivePromise<Void>- Specified by:
addListenerin interfacePromise<Void>- Overrides:
addListenerin classDefaultProgressivePromise<Void>
-
addListeners
public ChannelProgressivePromise addListeners(GenericFutureListener<? extends Future<? super Void>>... listeners) Description copied from interface:FutureAdds the specified listeners to this future. The specified listeners are notified when this future is done. If this future is already completed, the specified listeners are notified immediately.- Specified by:
addListenersin interfaceChannelFuture- Specified by:
addListenersin interfaceChannelProgressiveFuture- Specified by:
addListenersin interfaceChannelProgressivePromise- Specified by:
addListenersin interfaceChannelPromise- Specified by:
addListenersin interfaceFuture<Void>- Specified by:
addListenersin interfaceProgressiveFuture<Void>- Specified by:
addListenersin interfaceProgressivePromise<Void>- Specified by:
addListenersin interfacePromise<Void>- Overrides:
addListenersin classDefaultProgressivePromise<Void>
-
removeListener
public ChannelProgressivePromise removeListener(GenericFutureListener<? extends Future<? super Void>> listener) Description copied from interface:FutureRemoves the first occurrence of the specified listener from this future. The specified listener is no longer notified when this future is done. If the specified listener is not associated with this future, this method does nothing and returns silently.- Specified by:
removeListenerin interfaceChannelFuture- Specified by:
removeListenerin interfaceChannelProgressiveFuture- Specified by:
removeListenerin interfaceChannelProgressivePromise- Specified by:
removeListenerin interfaceChannelPromise- Specified by:
removeListenerin interfaceFuture<Void>- Specified by:
removeListenerin interfaceProgressiveFuture<Void>- Specified by:
removeListenerin interfaceProgressivePromise<Void>- Specified by:
removeListenerin interfacePromise<Void>- Overrides:
removeListenerin classDefaultProgressivePromise<Void>
-
removeListeners
public ChannelProgressivePromise removeListeners(GenericFutureListener<? extends Future<? super Void>>... listeners) Description copied from interface:FutureRemoves the first occurrence for each of the listeners from this future. The specified listeners are no longer notified when this future is done. If the specified listeners are not associated with this future, this method does nothing and returns silently.- Specified by:
removeListenersin interfaceChannelFuture- Specified by:
removeListenersin interfaceChannelProgressiveFuture- Specified by:
removeListenersin interfaceChannelProgressivePromise- Specified by:
removeListenersin interfaceChannelPromise- Specified by:
removeListenersin interfaceFuture<Void>- Specified by:
removeListenersin interfaceProgressiveFuture<Void>- Specified by:
removeListenersin interfaceProgressivePromise<Void>- Specified by:
removeListenersin interfacePromise<Void>- Overrides:
removeListenersin classDefaultProgressivePromise<Void>
-
sync
Description copied from interface:FutureWaits for this future until it is done, and rethrows the cause of the failure if this future failed.- Specified by:
syncin interfaceChannelFuture- Specified by:
syncin interfaceChannelProgressiveFuture- Specified by:
syncin interfaceChannelProgressivePromise- Specified by:
syncin interfaceChannelPromise- Specified by:
syncin interfaceFuture<Void>- Specified by:
syncin interfaceProgressiveFuture<Void>- Specified by:
syncin interfaceProgressivePromise<Void>- Specified by:
syncin interfacePromise<Void>- Overrides:
syncin classDefaultProgressivePromise<Void>- Throws:
InterruptedException
-
syncUninterruptibly
Description copied from interface:FutureWaits for this future until it is done, and rethrows the cause of the failure if this future failed.- Specified by:
syncUninterruptiblyin interfaceChannelFuture- Specified by:
syncUninterruptiblyin interfaceChannelProgressiveFuture- Specified by:
syncUninterruptiblyin interfaceChannelProgressivePromise- Specified by:
syncUninterruptiblyin interfaceChannelPromise- Specified by:
syncUninterruptiblyin interfaceFuture<Void>- Specified by:
syncUninterruptiblyin interfaceProgressiveFuture<Void>- Specified by:
syncUninterruptiblyin interfaceProgressivePromise<Void>- Specified by:
syncUninterruptiblyin interfacePromise<Void>- Overrides:
syncUninterruptiblyin classDefaultProgressivePromise<Void>
-
await
Description copied from interface:FutureWaits for this future to be completed.- Specified by:
awaitin interfaceChannelFuture- Specified by:
awaitin interfaceChannelProgressiveFuture- Specified by:
awaitin interfaceChannelProgressivePromise- Specified by:
awaitin interfaceChannelPromise- Specified by:
awaitin interfaceFuture<Void>- Specified by:
awaitin interfaceProgressiveFuture<Void>- Specified by:
awaitin interfaceProgressivePromise<Void>- Specified by:
awaitin interfacePromise<Void>- Overrides:
awaitin classDefaultProgressivePromise<Void>- Throws:
InterruptedException- if the current thread was interrupted
-
awaitUninterruptibly
Description copied from interface:FutureWaits for this future to be completed without interruption. This method catches anInterruptedExceptionand discards it silently.- Specified by:
awaitUninterruptiblyin interfaceChannelFuture- Specified by:
awaitUninterruptiblyin interfaceChannelProgressiveFuture- Specified by:
awaitUninterruptiblyin interfaceChannelProgressivePromise- Specified by:
awaitUninterruptiblyin interfaceChannelPromise- Specified by:
awaitUninterruptiblyin interfaceFuture<Void>- Specified by:
awaitUninterruptiblyin interfaceProgressiveFuture<Void>- Specified by:
awaitUninterruptiblyin interfaceProgressivePromise<Void>- Specified by:
awaitUninterruptiblyin interfacePromise<Void>- Overrides:
awaitUninterruptiblyin classDefaultProgressivePromise<Void>
-
flushCheckpoint
public long flushCheckpoint() -
flushCheckpoint
public void flushCheckpoint(long checkpoint) -
promise
-
checkDeadLock
protected void checkDeadLock()- Overrides:
checkDeadLockin classDefaultPromise<Void>
-
unvoid
Description copied from interface:ChannelPromise- Specified by:
unvoidin interfaceChannelProgressivePromise- Specified by:
unvoidin interfaceChannelPromise
-
isVoid
public boolean isVoid()Description copied from interface:ChannelFutureReturnstrueif thisChannelFutureis a void future and so not allow to call any of the following methods:- Specified by:
isVoidin interfaceChannelFuture
-