Class DefaultCancelFuture

All Implemented Interfaces:
CancelFuture, SshFuture<CancelFuture>, VerifiableFuture<Boolean>, WaitableFuture

public class DefaultCancelFuture extends DefaultSshFuture<CancelFuture> implements CancelFuture
A default implementation of a CancelFuture.
  • Field Details

  • Constructor Details

    • DefaultCancelFuture

      protected DefaultCancelFuture(Object id)
  • Method Details

    • verify

      public Boolean verify(long timeoutMillis, CancelOption... options) throws IOException
      Wait and verify that the operation was successful
      Specified by:
      verify in interface VerifiableFuture<Boolean>
      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 value of isCanceled()
      Throws:
      IOException - If failed to verify successfully on time
    • setCanceled

      public void setCanceled()
      Description copied from interface: CancelFuture
      Marks this CancelFuture as the cancellation having been effected.

      This is a framework-internal method.

      Specified by:
      setCanceled in interface CancelFuture
    • setCanceled

      public void setCanceled(Throwable error)
      Description copied from interface: CancelFuture
      Marks this CancelFuture as the cancellation having been effected.

      This is a framework-internal method.

      Specified by:
      setCanceled in interface CancelFuture
      Parameters:
      error - optional Throwable, if non-null, it'll be attached to the backtrace.
    • setNotCanceled

      public void setNotCanceled()
      Description copied from interface: CancelFuture
      Completes this future with a value indicating that the cancellation was not done.
      Specified by:
      setNotCanceled in interface CancelFuture
    • isCanceled

      public boolean isCanceled()
      Description copied from interface: CancelFuture
      Tells whether the cancellation has been effected. (WaitableFuture.isDone() && !isCanceled()) means the cancellation was not effected. In that case check the original operation for a success or failure value.
      Specified by:
      isCanceled in interface CancelFuture
      Returns:
      true if the cancellation was done; false otherwise
    • setBackTrace

      public void setBackTrace(CancellationException backTrace)
      Description copied from interface: CancelFuture
      Sets a CancellationException describing the stack trace of where the cancellation was initiated. Has no effect if a backtrace was already set, or the given backtrace is null.

      This is a framework-internal method.

      Specified by:
      setBackTrace in interface CancelFuture
      Parameters:
      backTrace - CancellationException to set
    • getBackTrace

      public CancellationException getBackTrace()
      Description copied from interface: CancelFuture
      Obtains an exception describing the stack trace of where the cancellation was initiated.
      Specified by:
      getBackTrace in interface CancelFuture
      Returns:
      a CancellationException