T - Type of futurepublic abstract class AbstractSshFuture<T extends SshFuture> extends AbstractLoggingBean implements SshFuture<T>
| Modifier and Type | Field and Description |
|---|---|
protected static Object |
CANCELED
A default value to indicate the future has been canceled
|
log| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSshFuture() |
| Modifier and Type | Method and Description |
|---|---|
protected SshFutureListener<T> |
asListener(Object o) |
protected T |
asT() |
boolean |
await(long timeoutMillis)
Wait for the asynchronous operation to complete with the specified timeout.
|
protected abstract Object |
await0(long timeoutMillis,
boolean interruptable)
Wait for the Future to be ready.
|
boolean |
awaitUninterruptibly(long timeoutMillis)
Wait for the asynchronous operation to complete with the specified timeout
uninterruptibly.
|
protected void |
notifyListener(SshFutureListener<T> l) |
protected <R> R |
verifyResult(Class<? extends R> expectedType,
long timeout)
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 an IOException then re-throw 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
|
getSimplifiedLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddListener, removeListenerawait, await, awaitUninterruptibly, awaitUninterruptibly, isDoneprotected static final Object CANCELED
public boolean await(long timeoutMillis)
throws IOException
WaitableFutureawait in interface WaitableFuturetimeoutMillis - Wait time in millisecondstrue if the operation is completed.IOException - if failed - specifically InterruptedIOException
if waiting was interruptedpublic boolean awaitUninterruptibly(long timeoutMillis)
WaitableFutureawaitUninterruptibly in interface WaitableFuturetimeoutMillis - Wait time in millisecondstrue if the operation is finished.protected <R> R verifyResult(Class<? extends R> expectedType, long timeout) 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 an IOException then re-throw 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 resultnull) resultIOException - If failed to retrieve the expected result on timeprotected abstract Object await0(long timeoutMillis, boolean interruptable) 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.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()
Copyright © 2008–2017 The Apache Software Foundation. All rights reserved.