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,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 CancelFutureCreates aCancelFutureif this future can be canceled.Retrieves theCancelFuture, ifCancellable.cancel()had been called.Returns the cause of the failure.booleanTells whether this operation was canceled.voidsetException(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, 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.VerifiableFuture
verify, verify, verify, verifyMethods inherited from interface org.apache.sshd.common.future.WaitableFuture
await, await, await, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly
-
Constructor Details
-
DefaultCancellableSshFuture
-
-
Method Details
-
isCanceled
public boolean isCanceled()Description copied from interface:CancellableTells whether this operation was canceled.- Specified by:
isCanceledin interfaceCancellable- Returns:
trueif the operation was cancelled,falseotherwise.
-
createCancellation
Description copied from class:DefaultSshFutureCreates aCancelFutureif this future can be canceled.This doesn't cancel this future yet.
- Overrides:
createCancellationin classDefaultSshFuture<T extends SshFuture<T>>- Returns:
- A
CancelFuturethat can be used to wait for the cancellation to have been effected, ornullif the future cannot be canceled.
-
cancel
Description copied from interface:CancellableAttempts to cancel the operation.- Specified by:
cancelin interfaceCancellable- Returns:
- A
CancelFuturethat can be used to wait for the cancellation to have been effected, ornullif the future cannot be canceled or is already completed.
-
getCancellation
Description copied from interface:CancellableRetrieves theCancelFuture, ifCancellable.cancel()had been called.- Specified by:
getCancellationin interfaceCancellable- Returns:
- The
CancelFutureif theCancellablehas already been canceled, ornullotherwise
-
getException
Description copied from interface:WithExceptionReturns the cause of the failure.- Specified by:
getExceptionin interfaceWithException- Returns:
- the
Throwableof the failure, ornullif not failed (yet).
-
setException
Sets the exception that caused the operation to fail. If theexceptioncannot be set but the future is already canceled, the exception will be reported through this future'sCancelFuture.- Specified by:
setExceptionin interfaceWithException- Parameters:
exception- TheThrowableto set; must be non-null
-