T - Type of futurepublic class DefaultSshFuture<T extends SshFuture<T>> extends AbstractSshFuture<T>
SshFuture.log| Constructor and Description |
|---|
DefaultSshFuture(Object id,
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 Object |
await0(long timeoutMillis,
boolean interruptable,
CancelOption... options)
Wait for the Future to be ready.
|
protected CancelFuture |
createCancellation()
Creates a
CancelFuture if this future can be canceled. |
int |
getNumRegisteredListeners() |
Object |
getValue() |
boolean |
isDone() |
protected void |
notifyListeners() |
protected void |
onValueSet(Object value)
Callback that is invoked under lock when the future's value is set.
|
T |
removeListener(SshFutureListener<T> listener)
Removes an existing event listener so it won't be notified when the future is completed.
|
void |
setValue(Object newValue)
Sets the result of the asynchronous operation, and mark it as finished.
|
String |
toString() |
asListener, asT, await, awaitUninterruptibly, formatExceptionMessage, getId, notifyListener, verifyResultdebug, 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, waitawait, await, await, await, await, await, await, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptiblyprotected Object await0(long timeoutMillis, boolean interruptable, CancelOption... options) throws InterruptedIOException
AbstractSshFutureawait0 in class AbstractSshFuture<T extends SshFuture<T>>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.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(Object newValue)
newValue - The operation resultpublic int getNumRegisteredListeners()
public 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()
protected CancelFuture createCancellation()
CancelFuture if this future can be canceled.
This doesn't cancel this future yet.
CancelFuture that can be used to wait for the cancellation to have been effected, or
null if the future cannot be canceled.protected void onValueSet(Object value)
As this is called under lock, subclasses should not do any elaborate processing. It is intended to give
subclasses a safe and convenient way to update local state before any listeners are invoked or callers waiting in
await0(long, boolean, CancelOption...) are woken up.
The default implementation does nothing.
value - that was just setCopyright © 2018–2024 The Apache Software Foundation. All rights reserved.