Class EndlessWriteFuture

java.lang.Object
org.apache.sshd.contrib.common.io.EndlessWriteFuture
All Implemented Interfaces:
HasException, SshFuture<IoWriteFuture>, VerifiableFuture<IoWriteFuture>, WaitableFuture, IoWriteFuture

public class EndlessWriteFuture extends Object implements IoWriteFuture
Never signals a successful write completion and ignores all listeners
  • Field Details

  • Constructor Details

    • EndlessWriteFuture

      public EndlessWriteFuture()
  • Method Details

    • verify

      public IoWriteFuture verify(long timeoutMillis, CancelOption... options) throws IOException
      Description copied from interface: VerifiableFuture
      Wait and verify that the operation was successful
      Specified by:
      verify in interface VerifiableFuture<IoWriteFuture>
      Parameters:
      timeoutMillis - Wait timeout in milliseconds
      options - Optional CancelOptions defining the behavior on time-out or interrupt; ignored if the future is not Cancellable.
      Returns:
      The (same) future instance
      Throws:
      IOException - If failed to verify successfully on time
    • isDone

      public boolean isDone()
      Specified by:
      isDone in interface WaitableFuture
      Returns:
      true if the asynchronous operation is completed. Note: it is up to the caller to determine whether it was a successful or failed completion.
    • getId

      public Object getId()
      Specified by:
      getId in interface WaitableFuture
      Returns:
      Some identifier useful as toString() value
    • awaitUninterruptibly

      public boolean awaitUninterruptibly(long timeoutMillis, CancelOption... options)
      Description copied from interface: WaitableFuture
      Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.
      Specified by:
      awaitUninterruptibly in interface WaitableFuture
      Parameters:
      timeoutMillis - Wait time in milliseconds
      options - Optional CancelOptions defining the behavior on time-out; ignored if the future is not Cancellable.
      Returns:
      true if the operation is finished.
    • await

      public boolean await(long timeoutMillis, CancelOption... options) throws IOException
      Description copied from interface: WaitableFuture
      Wait for the asynchronous operation to complete with the specified timeout.
      Specified by:
      await in interface WaitableFuture
      Parameters:
      timeoutMillis - Wait time in milliseconds
      options - Optional CancelOptions defining the behavior on time-out or interrupt; ignored if the future is not Cancellable.
      Returns:
      true if the operation is completed.
      Throws:
      IOException - if failed - specifically InterruptedIOException if waiting was interrupted
    • removeListener

      public IoWriteFuture removeListener(SshFutureListener<IoWriteFuture> listener)
      Description copied from interface: SshFuture
      Removes an existing event listener so it won't be notified when the future is completed.
      Specified by:
      removeListener in interface SshFuture<IoWriteFuture>
      Parameters:
      listener - The SshFutureListener instance to remove
      Returns:
      The future instance
    • addListener

      public IoWriteFuture addListener(SshFutureListener<IoWriteFuture> listener)
      Description copied from interface: SshFuture
      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.
      Specified by:
      addListener in interface SshFuture<IoWriteFuture>
      Parameters:
      listener - The SshFutureListener instance to add
      Returns:
      The future instance
    • isWritten

      public boolean isWritten()
      Specified by:
      isWritten in interface IoWriteFuture
      Returns:
      true if the write operation is finished successfully.
    • getException

      public Throwable getException()
      Description copied from interface: HasException
      Returns the cause of the failure.
      Specified by:
      getException in interface HasException
      Returns:
      the Throwable of the failure, or null if not failed (yet).