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<java.lang.Boolean>,WaitableFuture
public class DefaultCancelFuture extends DefaultSshFuture<CancelFuture> implements CancelFuture
A default implementation of aCancelFuture.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.CancellationExceptionbackTrace-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDefaultCancelFuture(java.lang.Object id)
-
Method Summary
All Methods Instance Methods Concrete 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.java.lang.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, 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
-
verify
public java.lang.Boolean verify(long timeoutMillis, CancelOption... options) throws java.io.IOExceptionWait and verify that the operation was successful- Specified by:
verifyin interfaceVerifiableFuture<java.lang.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:
java.io.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(java.lang.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(java.util.concurrent.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 java.util.concurrent.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
-
-