Package org.apache.sshd.common.future
Class DefaultCancelFuture
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.common.future.AbstractSshFuture<T>
-
- 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 aCancelFuture.- Author:
- Apache MINA SSHD Project
-
-
Field Summary
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDefaultCancelFuture(Object id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CancellationExceptiongetBackTrace()Obtains an exception describing the stack trace of where the cancellation was initiated.booleanisCanceled()Tells whether the cancellation has been effected.voidsetBackTrace(CancellationException backTrace)Sets aCancellationExceptiondescribing the stack trace of where the cancellation was initiated.voidsetCanceled()Marks thisCancelFutureas the cancellation having been effected.voidsetCanceled(Throwable error)Marks thisCancelFutureas the cancellation having been effected.voidsetNotCanceled()Completes this future with a value indicating that the cancellation was not done.Booleanverify(long timeoutMillis, CancelOption... options)Wait and verify that the operation was successful-
Methods inherited from class org.apache.sshd.common.future.DefaultSshFuture
addListener, await0, createCancellation, getNumRegisteredListeners, getValue, isDone, notifyListeners, onValueSet, removeListener, setValue, toString
-
Methods inherited from class org.apache.sshd.common.future.AbstractSshFuture
asListener, asT, await, awaitUninterruptibly, formatExceptionMessage, getId, notifyListener, verifyResult
-
Methods 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, warn
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
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
-
Methods inherited from interface org.apache.sshd.common.future.WaitableFuture
await, await, await, await, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, getId, isDone
-
-
-
-
Constructor Detail
-
DefaultCancelFuture
protected DefaultCancelFuture(Object id)
-
-
Method Detail
-
verify
public Boolean verify(long timeoutMillis, CancelOption... options) throws IOException
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
public void setCanceled(Throwable error)
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
public void setBackTrace(CancellationException backTrace)
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
public CancellationException 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
-
-