T - Type of futurepublic abstract class AbstractSshFuture<T extends SshFuture<T>> extends AbstractLoggingBean implements SshFuture<T>
log| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSshFuture(Object id) |
| Modifier and Type | Method and Description |
|---|---|
protected SshFutureListener<T> |
asListener(Object o) |
protected T |
asT() |
boolean |
await(long timeoutMillis,
CancelOption... options)
Wait for the asynchronous operation to complete with the specified timeout.
|
protected abstract Object |
await0(long timeoutMillis,
boolean interruptable,
CancelOption... options)
Wait for the Future to be ready.
|
boolean |
awaitUninterruptibly(long timeoutMillis,
CancelOption... options)
Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.
|
protected <E extends Throwable> |
formatExceptionMessage(Function<? super String,? extends E> exceptionCreator,
String format,
Object... args)
Generates an exception whose message is prefixed by the future simple class name +
identifier as
a hint to the context of the failure. |
Object |
getId() |
protected void |
notifyListener(SshFutureListener<T> l) |
String |
toString() |
protected <R> R |
verifyResult(Class<? extends R> expectedType,
long timeout,
CancelOption... options)
Waits (interruptible) for the specified timeout (msec.) and then checks the result:
|
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddListener, removeListenerawait, await, await, await, await, await, await, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, isDoneprotected AbstractSshFuture(Object id)
id - Some identifier useful as toString() valuepublic Object getId()
getId in interface WaitableFuturetoString() valuepublic boolean await(long timeoutMillis,
CancelOption... options)
throws IOException
WaitableFutureawait in interface WaitableFuturetimeoutMillis - Wait time in millisecondsoptions - Optional CancelOptions defining the behavior on time-out or interrupt; ignored if
the future is not Cancellable.true if the operation is completed.IOException - if failed - specifically InterruptedIOException if waiting was interruptedpublic boolean awaitUninterruptibly(long timeoutMillis,
CancelOption... options)
WaitableFutureawaitUninterruptibly in interface WaitableFuturetimeoutMillis - Wait time in millisecondsoptions - Optional CancelOptions defining the behavior on time-out; ignored if the future is
not Cancellable.true if the operation is finished.protected <R> R verifyResult(Class<? extends R> expectedType, long timeout, CancelOption... options) throws IOException
Waits (interruptible) for the specified timeout (msec.) and then checks the result:
If result is null then timeout is assumed to have expired - throw an appropriate IOException
If the result is of the expected type, then cast and return it
If the result is a Throwable then throw an IOException whose cause is the original exception
Otherwise (should never happen), throw a StreamCorruptedException with the name of the result type
R - The generic result typeexpectedType - The expected result typetimeout - The timeout (millis) to wait for a resultoptions - Optional CancelOptions defining the behavior on time-out or interrupt.null) resultIOException - If failed to retrieve the expected result on timeprotected abstract Object await0(long timeoutMillis, boolean interruptable, CancelOption... options) throws InterruptedIOException
timeoutMillis - The delay we will wait for the Future to be readyinterruptable - Tells if the wait can be interrupted or not. If true and the thread is
interrupted then an InterruptedIOException is thrown.options - Optional CancelOption defining the behavior on time-out or interrupt.null result object if the Future is ready, null if the
timeout expired and no result was receivedInterruptedIOException - If the thread has been interrupted when it's not allowed.protected SshFutureListener<T> asListener(Object o)
protected void notifyListener(SshFutureListener<T> l)
protected T asT()
protected <E extends Throwable> E formatExceptionMessage(Function<? super String,? extends E> exceptionCreator, String format, Object... args)
identifier as
a hint to the context of the failure.E - Type of Throwable being generatedexceptionCreator - The exception creator from the formatted messageformat - The extra payload format as per String.format(String, Object...)args - The formatting argumentsCopyright © 2018–2024 The Apache Software Foundation. All rights reserved.