T - Type of futurepublic class DefaultSshFuture<T extends SshFuture> extends AbstractSshFuture<T>
SshFuture.| Modifier and Type | Field and Description |
|---|---|
private java.lang.Object |
listeners |
private java.lang.Object |
lock
A lock used by the wait() method
|
private java.lang.Object |
result |
CANCELED, debugEnabled, traceEnabledlog| Constructor and Description |
|---|
DefaultSshFuture(java.lang.Object id,
java.lang.Object lock)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
T |
addListener(SshFutureListener<T> listener)
Adds an event listener which is notified when
this future is completed.
|
protected java.lang.Object |
await0(long timeoutMillis,
boolean interruptable)
Wait for the Future to be ready.
|
void |
cancel() |
int |
getNumRegisteredListeners() |
java.lang.Object |
getValue() |
boolean |
isCanceled() |
boolean |
isDone() |
protected void |
notifyListeners() |
T |
removeListener(SshFutureListener<T> listener)
Removes an existing event listener so it won't be notified when
the future is completed.
|
void |
setValue(java.lang.Object newValue)
Sets the result of the asynchronous operation, and mark it as finished.
|
java.lang.String |
toString() |
asListener, asT, await, awaitUninterruptibly, formatExceptionMessage, getId, notifyListener, verifyResultgetSimplifiedLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitawait, await, awaitUninterruptibly, awaitUninterruptiblyprivate final java.lang.Object lock
private java.lang.Object listeners
private java.lang.Object result
public DefaultSshFuture(java.lang.Object id,
java.lang.Object lock)
id - Some identifier useful as toString() valuelock - A synchronization object for locking access - if null
then synchronization occurs on this instanceprotected java.lang.Object await0(long timeoutMillis,
boolean interruptable)
throws java.io.InterruptedIOException
AbstractSshFutureawait0 in class AbstractSshFuture<T extends SshFuture>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 receivedjava.io.InterruptedIOException - If the thread has been interrupted when it's not allowed.public boolean isDone()
true if the asynchronous operation is completed. Note:
it is up to the caller to determine whether it was a successful or
failed completion.public void setValue(java.lang.Object newValue)
newValue - The operation resultpublic int getNumRegisteredListeners()
public java.lang.Object getValue()
null
if none set.public T addListener(SshFutureListener<T> listener)
SshFuturelistener - The SshFutureListener instance to addpublic T removeListener(SshFutureListener<T> listener)
SshFuturelistener - The SshFutureListener instance to removeprotected void notifyListeners()
public boolean isCanceled()
public void cancel()
public java.lang.String toString()
toString in class AbstractSshFuture<T extends SshFuture>