Interface IoFuture

All Known Subinterfaces:
CloseFuture, ConnectFuture, ReadFuture, WriteFuture
All Known Implementing Classes:
AbstractIoAcceptor.AcceptorOperationFuture, AbstractIoService.ServiceOperationFuture, AbstractPollingIoConnector.ConnectionRequest, CompositeIoFuture, DefaultCloseFuture, DefaultConnectFuture, DefaultIoFuture, DefaultReadFuture, DefaultWriteFuture

public interface IoFuture
Represents the completion of an asynchronous I/O operation on an IoSession. Can be listened for completion using a IoFutureListener.
  • Method Details

    • getSession

      IoSession getSession()
      Returns:
      the IoSession which is associated with this future.
    • await

      Wait for the asynchronous operation to complete. The attached listeners will be notified when the operation is completed.
      Returns:
      The instance of IoFuture that we are waiting for
      Throws:
      InterruptedException - If the thread is interrupted while waiting
    • await

      boolean await(long timeout, TimeUnit unit) throws InterruptedException
      Wait for the asynchronous operation to complete with the specified timeout.
      Parameters:
      timeout - The maximum delay to wait before getting out
      unit - the type of unit for the delay (seconds, minutes...)
      Returns:
      true if the operation is completed.
      Throws:
      InterruptedException - If the thread is interrupted while waiting
    • await

      boolean await(long timeoutMillis) throws InterruptedException
      Wait for the asynchronous operation to complete with the specified timeout.
      Parameters:
      timeoutMillis - The maximum milliseconds to wait before getting out
      Returns:
      true if the operation is completed.
      Throws:
      InterruptedException - If the thread is interrupted while waiting
    • awaitUninterruptibly

      IoFuture awaitUninterruptibly()
      Wait for the asynchronous operation to complete uninterruptibly. The attached listeners will be notified when the operation is completed.
      Returns:
      the current IoFuture
    • awaitUninterruptibly

      boolean awaitUninterruptibly(long timeout, TimeUnit unit)
      Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.
      Parameters:
      timeout - The maximum delay to wait before getting out
      unit - the type of unit for the delay (seconds, minutes...)
      Returns:
      true if the operation is completed.
    • awaitUninterruptibly

      boolean awaitUninterruptibly(long timeoutMillis)
      Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.
      Parameters:
      timeoutMillis - The maximum milliseconds to wait before getting out
      Returns:
      true if the operation is finished.
    • join

      @Deprecated void join()
      Deprecated.
      Replaced with awaitUninterruptibly().
    • join

      @Deprecated boolean join(long timeoutMillis)
      Deprecated.
      Parameters:
      timeoutMillis - The time to wait for the join before bailing out
      Returns:
      true if the join was successful
    • isDone

      boolean isDone()
      Returns:
      true if the operation is completed.
    • addListener

      IoFuture addListener(IoFutureListener<?> listener)
      Adds an event listener which is notified when this future is completed. If the listener is added after the completion, the listener is directly notified.
      Parameters:
      listener - The listener to add
      Returns:
      the current IoFuture
    • removeListener

      IoFuture removeListener(IoFutureListener<?> listener)
      Removes an existing event listener so it won't be notified when the future is completed.
      Parameters:
      listener - The listener to remove
      Returns:
      the current IoFuture