Package org.apache.sshd.common.future
Class DefaultCancellableSshFuture<T extends SshFuture<T>>
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.common.future.AbstractSshFuture<T>
org.apache.sshd.common.future.DefaultSshFuture<T>
org.apache.sshd.common.future.DefaultVerifiableSshFuture<T>
org.apache.sshd.common.future.DefaultCancellableSshFuture<T>
- Type Parameters:
T
- Type of future
- All Implemented Interfaces:
Cancellable
,HasException
,SshFuture<T>
,VerifiableFuture<T>
,WaitableFuture
,WithException
- Direct Known Subclasses:
DefaultAuthFuture
,DefaultConnectFuture
,DefaultIoConnectFuture
,DefaultOpenFuture
public abstract class DefaultCancellableSshFuture<T extends SshFuture<T>>
extends DefaultVerifiableSshFuture<T>
implements Cancellable
A default
Cancellable
future implementation.-
Field Summary
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncancel()
Attempts to cancel the operation.protected CancelFuture
Creates aCancelFuture
if this future can be canceled.Retrieves theCancelFuture
, ifCancellable.cancel()
had been called.Returns the cause of the failure.boolean
Tells whether this operation was canceled.void
setException
(Throwable exception) Sets the exception that caused the operation to fail.Methods inherited from class org.apache.sshd.common.future.DefaultSshFuture
addListener, await0, 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.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, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly
-
Constructor Details
-
DefaultCancellableSshFuture
-
-
Method Details
-
isCanceled
public boolean isCanceled()Description copied from interface:Cancellable
Tells whether this operation was canceled.- Specified by:
isCanceled
in interfaceCancellable
- Returns:
true
if the operation was cancelled,false
otherwise.
-
createCancellation
Description copied from class:DefaultSshFuture
Creates aCancelFuture
if this future can be canceled.This doesn't cancel this future yet.
- Overrides:
createCancellation
in classDefaultSshFuture<T extends SshFuture<T>>
- Returns:
- A
CancelFuture
that can be used to wait for the cancellation to have been effected, ornull
if the future cannot be canceled.
-
cancel
Description copied from interface:Cancellable
Attempts to cancel the operation.- Specified by:
cancel
in interfaceCancellable
- Returns:
- A
CancelFuture
that can be used to wait for the cancellation to have been effected, ornull
if the future cannot be canceled or is already completed.
-
getCancellation
Description copied from interface:Cancellable
Retrieves theCancelFuture
, ifCancellable.cancel()
had been called.- Specified by:
getCancellation
in interfaceCancellable
- Returns:
- The
CancelFuture
if theCancellable
has already been canceled, ornull
otherwise
-
getException
Description copied from interface:HasException
Returns the cause of the failure.- Specified by:
getException
in interfaceHasException
- Returns:
- the
Throwable
of the failure, ornull
if not failed (yet).
-
setException
Sets the exception that caused the operation to fail. If theexception
cannot be set but the future is already canceled, the exception will be reported through this future'sCancelFuture
.- Specified by:
setException
in interfaceWithException
- Parameters:
exception
- TheThrowable
to set; must be non-null
-