T - Type of futurepublic class DefaultSshFuture<T extends SshFuture> extends AbstractSshFuture<T>
SshFuture.CANCELEDlog| Constructor and Description |
|---|
DefaultSshFuture(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)
Wait for the Future to be ready.
|
void |
cancel() |
int |
getNumRegisteredListeners() |
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(Object newValue)
Sets the result of the asynchronous operation, and mark it as finished.
|
asListener, asT, await, awaitUninterruptibly, notifyListener, verifyResultgetSimplifiedLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitawait, await, awaitUninterruptibly, awaitUninterruptiblypublic DefaultSshFuture(Object lock)
lock - A synchronization object for locking access - if null
then synchronization occurs on this instanceprotected Object await0(long timeoutMillis, boolean interruptable) throws 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 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()
public boolean isCanceled()
public void cancel()
Copyright © 2008–2017 The Apache Software Foundation. All rights reserved.