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.boolean
Tells whether the cancellation has been effected.void
setBackTrace
(CancellationException backTrace) Sets aCancellationException
describing the stack trace of where the cancellation was initiated.void
Marks thisCancelFuture
as the cancellation having been effected.void
setCanceled
(Throwable error) Marks thisCancelFuture
as the cancellation having been effected.void
Completes 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, 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
-
Field Details
-
backTrace
-
-
Constructor Details
-
DefaultCancelFuture
-
-
Method Details
-
verify
Wait and verify that the operation was successful- Specified by:
verify
in interfaceVerifiableFuture<Boolean>
- Parameters:
timeoutMillis
- Wait timeout in millisecondsoptions
- Optionalinvalid reference
CancelOptions
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 thisCancelFuture
as the cancellation having been effected.This is a framework-internal method.
- Specified by:
setCanceled
in interfaceCancelFuture
-
setCanceled
Description copied from interface:CancelFuture
Marks thisCancelFuture
as the cancellation having been effected.This is a framework-internal method.
- Specified by:
setCanceled
in interfaceCancelFuture
- Parameters:
error
- optionalThrowable
, 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 interfaceCancelFuture
-
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 interfaceCancelFuture
- Returns:
true
if the cancellation was done;false
otherwise
-
setBackTrace
Description copied from interface:CancelFuture
Sets aCancellationException
describing 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:
setBackTrace
in interfaceCancelFuture
- Parameters:
backTrace
-CancellationException
to set
-
getBackTrace
Description copied from interface:CancelFuture
Obtains an exception describing the stack trace of where the cancellation was initiated.- Specified by:
getBackTrace
in interfaceCancelFuture
- Returns:
- a
CancellationException
-