T
- Type of futurepublic class DefaultSshFuture<T extends SshFuture> extends AbstractSshFuture<T>
SshFuture
.CANCELED
log
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() |
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, await, await, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, notifyListener, verifyResult
public 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
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 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()
Copyright © 2008–2016 The Apache Software Foundation. All rights reserved.