Package org.apache.sshd.common.future
Interface CancelFuture
-
- All Superinterfaces:
SshFuture<CancelFuture>,VerifiableFuture<java.lang.Boolean>,WaitableFuture
- All Known Implementing Classes:
DefaultCancelFuture
public interface CancelFuture extends SshFuture<CancelFuture>, VerifiableFuture<java.lang.Boolean>
Cancellations may not always be effective immediately. While a cancelledCancellablefuture is considered canceled immediately, it may take some time until the underlying asynchronous operation is really canceled. A cancellation throughCancellable.cancel()returns aCancelFuturethat can be used to wait for the cancellation to have been effected.A
CancelFutureis not cancellable itself.- See Also:
Cancellable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.concurrent.CancellationExceptiongetBackTrace()Obtains an exception describing the stack trace of where the cancellation was initiated.booleanisCanceled()Tells whether the cancellation has been effected.voidsetBackTrace(java.util.concurrent.CancellationException backTrace)Sets aCancellationExceptiondescribing the stack trace of where the cancellation was initiated.voidsetCanceled()Marks thisCancelFutureas the cancellation having been effected.voidsetCanceled(java.lang.Throwable error)Marks thisCancelFutureas the cancellation having been effected.voidsetNotCanceled()Completes this future with a value indicating that the cancellation was not done.-
Methods inherited from interface org.apache.sshd.common.future.SshFuture
addListener, removeListener
-
Methods inherited from interface org.apache.sshd.common.future.VerifiableFuture
verify, verify, verify, verify, verify, verify, verify, verify
-
Methods inherited from interface org.apache.sshd.common.future.WaitableFuture
await, await, await, await, await, await, await, await, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, getId, isDone
-
-
-
-
Method Detail
-
getBackTrace
java.util.concurrent.CancellationException getBackTrace()
Obtains an exception describing the stack trace of where the cancellation was initiated.- Returns:
- a
CancellationException
-
isCanceled
boolean isCanceled()
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.- Returns:
trueif the cancellation was done;falseotherwise
-
setCanceled
void setCanceled()
Marks thisCancelFutureas the cancellation having been effected.This is a framework-internal method.
-
setCanceled
void setCanceled(java.lang.Throwable error)
Marks thisCancelFutureas the cancellation having been effected.This is a framework-internal method.
- Parameters:
error- optionalThrowable, if non-null, it'll be attached to the backtrace.
-
setBackTrace
void setBackTrace(java.util.concurrent.CancellationException backTrace)
Sets aCancellationExceptiondescribing the stack trace of where the cancellation was initiated. Has no effect if a backtrace was already set, or the given backtrace isnull.This is a framework-internal method.
- Parameters:
backTrace-CancellationExceptionto set
-
setNotCanceled
void setNotCanceled()
Completes this future with a value indicating that the cancellation was not done.
-
-