T
- Type of futurepublic class DefaultSshFuture<T extends SshFuture> extends AbstractSshFuture<T>
SshFuture
.CANCELED
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)
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.
|
String |
toString() |
asListener, asT, await, awaitUninterruptibly, formatExceptionMessage, getId, notifyListener, verifyResult
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
await, await, await, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly
protected Object await0(long timeoutMillis, boolean interruptable) throws InterruptedIOException
AbstractSshFuture
await0
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)
SshFuture
listener
- The SshFutureListener
instance to addpublic T removeListener(SshFutureListener<T> listener)
SshFuture
listener
- The SshFutureListener
instance to removeprotected void notifyListeners()
public boolean isCanceled()
public void cancel()
public String toString()
toString
in class AbstractSshFuture<T extends SshFuture>
Copyright © 2008–2024 The Apache Software Foundation. All rights reserved.