Package org.apache.sshd.common.future
Interface WaitableFuture
-
- All Known Subinterfaces:
AuthFuture
,CloseFuture
,ConnectFuture
,IoConnectFuture
,IoReadFuture
,IoWriteFuture
,KeyExchangeFuture
,OpenFuture
,SshFuture<T>
- All Known Implementing Classes:
AbstractIoWriteFuture
,AbstractSshFuture
,ChannelAsyncInputStream.IoReadFutureImpl
,DefaultAuthFuture
,DefaultCloseFuture
,DefaultConnectFuture
,DefaultKeyExchangeFuture
,DefaultOpenFuture
,DefaultSshFuture
,DefaultVerifiableSshFuture
,IoWriteFutureImpl
,Nio2Connector.DefaultIoConnectFuture
,Nio2DefaultIoWriteFuture
,PendingWriteFuture
public interface WaitableFuture
Represents an asynchronous operation which one can wait for its completion. Note: the only thing guaranteed is that iftrue
is returned from one of theawaitXXX
methods then the operation has completed. However, the caller has to determine whether it was a successful or failed completion.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default boolean
await()
WaitLong.MAX_VALUE
msec.boolean
await(long timeoutMillis)
Wait for the asynchronous operation to complete with the specified timeout.default boolean
await(long timeout, java.util.concurrent.TimeUnit unit)
Wait for the asynchronous operation to complete with the specified timeout.default boolean
awaitUninterruptibly()
WaitLong.MAX_VALUE
msec.boolean
awaitUninterruptibly(long timeoutMillis)
Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.default boolean
awaitUninterruptibly(long timeout, java.util.concurrent.TimeUnit unit)
Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.java.lang.Object
getId()
boolean
isDone()
-
-
-
Method Detail
-
getId
java.lang.Object getId()
- Returns:
- Some identifier useful as
toString()
value
-
await
default boolean await() throws java.io.IOException
WaitLong.MAX_VALUE
msec. for the asynchronous operation to complete. The attached listeners will be notified when the operation is completed.- Returns:
true
if the operation is completed.- Throws:
java.io.IOException
- if failed - specificallyInterruptedIOException
if waiting was interrupted- See Also:
await(long)
-
await
default boolean await(long timeout, java.util.concurrent.TimeUnit unit) throws java.io.IOException
Wait for the asynchronous operation to complete with the specified timeout.- Parameters:
timeout
- The number of time units to waitunit
- TheTimeUnit
for waiting- Returns:
true
if the operation is completed.- Throws:
java.io.IOException
- if failed - specificallyInterruptedIOException
if waiting was interrupted- See Also:
await(long)
-
await
boolean await(long timeoutMillis) throws java.io.IOException
Wait for the asynchronous operation to complete with the specified timeout.- Parameters:
timeoutMillis
- Wait time in milliseconds- Returns:
true
if the operation is completed.- Throws:
java.io.IOException
- if failed - specificallyInterruptedIOException
if waiting was interrupted
-
awaitUninterruptibly
default boolean awaitUninterruptibly()
WaitLong.MAX_VALUE
msec. for the asynchronous operation to complete uninterruptibly. The attached listeners will be notified when the operation is completed.- Returns:
true
if the operation is completed.- See Also:
awaitUninterruptibly(long)
-
awaitUninterruptibly
default boolean awaitUninterruptibly(long timeout, java.util.concurrent.TimeUnit unit)
Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.- Parameters:
timeout
- The number of time units to waitunit
- TheTimeUnit
for waiting- Returns:
true
if the operation is completed.- See Also:
awaitUninterruptibly(long)
-
awaitUninterruptibly
boolean awaitUninterruptibly(long timeoutMillis)
Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.- Parameters:
timeoutMillis
- Wait time in milliseconds- Returns:
true
if the operation is finished.
-
isDone
boolean isDone()
- Returns:
true
if the asynchronous operation is completed. Note: it is up to the caller to determine whether it was a successful or failed completion.
-
-