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:
DefaultIoConnectFuture
public abstract class DefaultCancellableSshFuture<T extends SshFuture<T>> extends DefaultVerifiableSshFuture<T> implements Cancellable
A defaultCancellablefuture implementation.- 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 protectedDefaultCancellableSshFuture(Object id, Object lock)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CancelFuturecancel()Attempts to cancel the operation.protected CancelFuturecreateCancellation()Creates aCancelFutureif this future can be canceled.CancelFuturegetCancellation()Retrieves theCancelFuture, ifCancellable.cancel()had been called.ThrowablegetException()Returns the cause of the failure.booleanisCanceled()Tells 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, 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
-
Methods inherited from interface org.apache.sshd.common.future.WaitableFuture
await, await, await, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly
-
-
-
-
Method Detail
-
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
protected CancelFuture 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
public CancelFuture 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
public CancelFuture 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
public Throwable 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
public void setException(Throwable exception)
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
-
-