Interface ChannelPromise

All Superinterfaces:
ChannelFuture, Future<java.lang.Void>, java.util.concurrent.Future<java.lang.Void>, Promise<java.lang.Void>
All Known Subinterfaces:
ChannelProgressivePromise
All Known Implementing Classes:
AbstractBootstrap.PendingRegistrationPromise, AbstractChannel.CloseFuture, DefaultChannelProgressivePromise, DefaultChannelPromise, DelegatingChannelPromiseNotifier, Http2CodecUtil.SimpleChannelPromiseAggregator, VoidChannelPromise

public interface ChannelPromise extends ChannelFuture, Promise<java.lang.Void>
Special ChannelFuture which is writable.
  • Method Details

    • channel

      Channel channel()
      Description copied from interface: ChannelFuture
      Returns a channel where the I/O operation associated with this future takes place.
      Specified by:
      channel in interface ChannelFuture
    • setSuccess

      ChannelPromise setSuccess(java.lang.Void result)
      Description copied from interface: Promise
      Marks this future as a success and notifies all listeners. If it is success or failed already it will throw an IllegalStateException.
      Specified by:
      setSuccess in interface Promise<java.lang.Void>
    • setSuccess

      ChannelPromise setSuccess()
    • trySuccess

      boolean trySuccess()
    • setFailure

      ChannelPromise setFailure(java.lang.Throwable cause)
      Description copied from interface: Promise
      Marks this future as a failure and notifies all listeners. If it is success or failed already it will throw an IllegalStateException.
      Specified by:
      setFailure in interface Promise<java.lang.Void>
    • addListener

      ChannelPromise addListener(GenericFutureListener<? extends Future<? super java.lang.Void>> listener)
      Description copied from interface: Future
      Adds 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:
      addListener in interface ChannelFuture
      Specified by:
      addListener in interface Future<java.lang.Void>
      Specified by:
      addListener in interface Promise<java.lang.Void>
    • addListeners

      ChannelPromise addListeners(GenericFutureListener<? extends Future<? super java.lang.Void>>... listeners)
      Description copied from interface: Future
      Adds 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:
      addListeners in interface ChannelFuture
      Specified by:
      addListeners in interface Future<java.lang.Void>
      Specified by:
      addListeners in interface Promise<java.lang.Void>
    • removeListener

      ChannelPromise removeListener(GenericFutureListener<? extends Future<? super java.lang.Void>> listener)
      Description copied from interface: Future
      Removes 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:
      removeListener in interface ChannelFuture
      Specified by:
      removeListener in interface Future<java.lang.Void>
      Specified by:
      removeListener in interface Promise<java.lang.Void>
    • removeListeners

      ChannelPromise removeListeners(GenericFutureListener<? extends Future<? super java.lang.Void>>... listeners)
      Description copied from interface: Future
      Removes 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:
      removeListeners in interface ChannelFuture
      Specified by:
      removeListeners in interface Future<java.lang.Void>
      Specified by:
      removeListeners in interface Promise<java.lang.Void>
    • sync

      ChannelPromise sync() throws java.lang.InterruptedException
      Description copied from interface: Future
      Waits for this future until it is done, and rethrows the cause of the failure if this future failed.
      Specified by:
      sync in interface ChannelFuture
      Specified by:
      sync in interface Future<java.lang.Void>
      Specified by:
      sync in interface Promise<java.lang.Void>
      Throws:
      java.lang.InterruptedException
    • syncUninterruptibly

      ChannelPromise syncUninterruptibly()
      Description copied from interface: Future
      Waits for this future until it is done, and rethrows the cause of the failure if this future failed.
      Specified by:
      syncUninterruptibly in interface ChannelFuture
      Specified by:
      syncUninterruptibly in interface Future<java.lang.Void>
      Specified by:
      syncUninterruptibly in interface Promise<java.lang.Void>
    • await

      ChannelPromise await() throws java.lang.InterruptedException
      Description copied from interface: Future
      Waits for this future to be completed.
      Specified by:
      await in interface ChannelFuture
      Specified by:
      await in interface Future<java.lang.Void>
      Specified by:
      await in interface Promise<java.lang.Void>
      Throws:
      java.lang.InterruptedException - if the current thread was interrupted
    • awaitUninterruptibly

      ChannelPromise awaitUninterruptibly()
      Description copied from interface: Future
      Waits for this future to be completed without interruption. This method catches an InterruptedException and discards it silently.
      Specified by:
      awaitUninterruptibly in interface ChannelFuture
      Specified by:
      awaitUninterruptibly in interface Future<java.lang.Void>
      Specified by:
      awaitUninterruptibly in interface Promise<java.lang.Void>
    • unvoid

      ChannelPromise unvoid()
      Returns a new ChannelPromise if ChannelFuture.isVoid() returns true otherwise itself.