Package org.apache.sshd.common.future
Class DefaultCancelFuture
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.common.future.AbstractSshFuture<CancelFuture>
org.apache.sshd.common.future.DefaultSshFuture<CancelFuture>
org.apache.sshd.common.future.DefaultCancelFuture
- All Implemented Interfaces:
CancelFuture,SshFuture<CancelFuture>,VerifiableFuture<Boolean>,WaitableFuture
public class DefaultCancelFuture
extends DefaultSshFuture<CancelFuture>
implements CancelFuture, VerifiableFuture<Boolean>
A default implementation of a
CancelFuture.-
Field Summary
FieldsFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionObtains an exception describing the stack trace of where the cancellation was initiated.booleanTells whether the cancellation has been effected.voidsetBackTrace(CancellationException backTrace) Sets aCancellationExceptiondescribing the stack trace of where the cancellation was initiated.voidMarks thisCancelFutureas the cancellation having been effected.voidsetCanceled(Throwable error) Marks thisCancelFutureas the cancellation having been effected.voidCompletes this future with a value indicating that the cancellation was not done.verify(long timeoutMillis, CancelOption... options) Wait and verify that the operation was successfulMethods inherited from class org.apache.sshd.common.future.DefaultSshFuture
addListener, await0, createCancellation, getNumRegisteredListeners, getValue, isDone, notifyListeners, onValueSet, removeListener, setValue, toStringMethods inherited from class org.apache.sshd.common.future.AbstractSshFuture
asListener, asT, await, awaitUninterruptibly, formatExceptionMessage, getId, notifyListener, verifyResultMethods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.sshd.common.future.SshFuture
addListener, removeListenerMethods inherited from interface org.apache.sshd.common.future.VerifiableFuture
verify, verify, verifyMethods inherited from interface org.apache.sshd.common.future.WaitableFuture
await, await, await, await, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, getId, isDone
-
Field Details
-
backTrace
-
-
Constructor Details
-
DefaultCancelFuture
-
-
Method Details
-
verify
Wait and verify that the operation was successful- Specified by:
verifyin interfaceVerifiableFuture<Boolean>- Parameters:
timeoutMillis- Wait timeout in millisecondsoptions- OptionalCancelOptions defining the behavior on time-out or interrupt; ignored if the future is notCancellable.- Returns:
- the value of
isCanceled() - Throws:
IOException- If failed to verify successfully on time
-
setCanceled
public void setCanceled()Description copied from interface:CancelFutureMarks thisCancelFutureas the cancellation having been effected.This is a framework-internal method.
- Specified by:
setCanceledin interfaceCancelFuture
-
setCanceled
Description copied from interface:CancelFutureMarks thisCancelFutureas the cancellation having been effected.This is a framework-internal method.
- Specified by:
setCanceledin interfaceCancelFuture- Parameters:
error- optionalThrowable, if non-null, it'll be attached to the backtrace.
-
setNotCanceled
public void setNotCanceled()Description copied from interface:CancelFutureCompletes this future with a value indicating that the cancellation was not done.- Specified by:
setNotCanceledin interfaceCancelFuture
-
isCanceled
public boolean isCanceled()Description copied from interface:CancelFutureTells 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:
isCanceledin interfaceCancelFuture- Returns:
trueif the cancellation was done;falseotherwise
-
setBackTrace
Description copied from interface:CancelFutureSets 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.
- Specified by:
setBackTracein interfaceCancelFuture- Parameters:
backTrace-CancellationExceptionto set
-
getBackTrace
Description copied from interface:CancelFutureObtains an exception describing the stack trace of where the cancellation was initiated.- Specified by:
getBackTracein interfaceCancelFuture- Returns:
- a
CancellationException
-