Package org.apache.sshd.common.future
Interface WaitableFuture
-
- All Known Subinterfaces:
AuthFuture,CancelFuture,CloseFuture,ConnectFuture,IoConnectFuture,IoReadFuture,IoWriteFuture,KeyExchangeFuture,OpenFuture,SshFuture<T>
- All Known Implementing Classes:
AbstractIoWriteFuture,AbstractSshFuture,ChannelAsyncInputStream.IoReadFutureImpl,ChannelAsyncOutputStream.BufferedFuture,DefaultAuthFuture,DefaultCancelFuture,DefaultCancellableSshFuture,DefaultCloseFuture,DefaultConnectFuture,DefaultIoConnectFuture,DefaultKeyExchangeFuture,DefaultOpenFuture,DefaultSshFuture,DefaultVerifiableSshFuture,GlobalRequestFuture,IoWriteFutureImpl,Nio2DefaultIoWriteFuture,PendingWriteFuture,SimpleIoOutputStream.DefaultIoWriteFuture
public interface WaitableFutureRepresents an asynchronous operation which one can wait for its completion. Note: the only thing guaranteed is that iftrueis returned from one of theawaitXXXmethods 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 booleanawait()WaitLong.MAX_VALUEmsec.default booleanawait(long timeoutMillis)Wait for the asynchronous operation to complete with the specified timeout.default booleanawait(long timeout, java.util.concurrent.TimeUnit unit)Wait for the asynchronous operation to complete with the specified timeout.default booleanawait(long timeout, java.util.concurrent.TimeUnit unit, CancelOption... options)Wait for the asynchronous operation to complete with the specified timeout.booleanawait(long timeoutMillis, CancelOption... options)Wait for the asynchronous operation to complete with the specified timeout.default booleanawait(java.time.Duration timeout)Wait for the asynchronous operation to complete with the specified timeout.default booleanawait(java.time.Duration timeout, CancelOption... options)Wait for the asynchronous operation to complete with the specified timeout.default booleanawait(CancelOption... options)WaitLong.MAX_VALUEmsec.default booleanawaitUninterruptibly()WaitLong.MAX_VALUEmsec.default booleanawaitUninterruptibly(long timeoutMillis)Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.default booleanawaitUninterruptibly(long timeout, java.util.concurrent.TimeUnit unit)Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.default booleanawaitUninterruptibly(long timeout, java.util.concurrent.TimeUnit unit, CancelOption... options)Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.booleanawaitUninterruptibly(long timeoutMillis, CancelOption... options)Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.default booleanawaitUninterruptibly(java.time.Duration timeoutMillis)Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.default booleanawaitUninterruptibly(java.time.Duration timeoutMillis, CancelOption... options)Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.default booleanawaitUninterruptibly(CancelOption... options)WaitLong.MAX_VALUEmsec.java.lang.ObjectgetId()booleanisDone()
-
-
-
Method Detail
-
getId
java.lang.Object getId()
- Returns:
- Some identifier useful as
toString()value
-
await
default boolean await() throws java.io.IOExceptionWaitLong.MAX_VALUEmsec. for the asynchronous operation to complete. The attached listeners will be notified when the operation is completed.- Returns:
trueif the operation is completed.- Throws:
java.io.IOException- if failed - specificallyInterruptedIOExceptionif waiting was interrupted- See Also:
await(long, CancelOption[])
-
await
default boolean await(CancelOption... options) throws java.io.IOException
WaitLong.MAX_VALUEmsec. for the asynchronous operation to complete. The attached listeners will be notified when the operation is completed.- Parameters:
options- OptionalCancelOptions defining the behavior on time-out or interrupt; ignored if the future is notCancellable.- Returns:
trueif the operation is completed.- Throws:
java.io.IOException- if failed - specificallyInterruptedIOExceptionif waiting was interrupted- See Also:
await(long, CancelOption[])
-
await
default boolean await(long timeout, java.util.concurrent.TimeUnit unit) throws java.io.IOExceptionWait for the asynchronous operation to complete with the specified timeout.- Parameters:
timeout- The number of time units to waitunit- TheTimeUnitfor waiting- Returns:
trueif the operation is completed.- Throws:
java.io.IOException- if failed - specificallyInterruptedIOExceptionif waiting was interrupted- See Also:
await(long, CancelOption[])
-
await
default boolean await(long timeout, java.util.concurrent.TimeUnit unit, CancelOption... options) throws java.io.IOExceptionWait for the asynchronous operation to complete with the specified timeout.- Parameters:
timeout- The number of time units to waitunit- TheTimeUnitfor waitingoptions- OptionalCancelOptions defining the behavior on time-out or interrupt; ignored if the future is notCancellable.- Returns:
trueif the operation is completed.- Throws:
java.io.IOException- if failed - specificallyInterruptedIOExceptionif waiting was interrupted- See Also:
await(long, CancelOption[])
-
await
default boolean await(java.time.Duration timeout) throws java.io.IOExceptionWait for the asynchronous operation to complete with the specified timeout.- Parameters:
timeout- The maximum duration to wait,nullto wait forever- Returns:
trueif the operation is completed.- Throws:
java.io.IOException- if failed - specificallyInterruptedIOExceptionif waiting was interrupted- See Also:
await(long, CancelOption[])
-
await
default boolean await(java.time.Duration timeout, CancelOption... options) throws java.io.IOExceptionWait for the asynchronous operation to complete with the specified timeout.- Parameters:
timeout- The maximum duration to wait,nullto wait foreveroptions- OptionalCancelOptions defining the behavior on time-out or interrupt; ignored if the future is notCancellable.- Returns:
trueif the operation is completed.- Throws:
java.io.IOException- if failed - specificallyInterruptedIOExceptionif waiting was interrupted- See Also:
await(long, CancelOption[])
-
await
default boolean await(long timeoutMillis) throws java.io.IOExceptionWait for the asynchronous operation to complete with the specified timeout.- Parameters:
timeoutMillis- Wait time in milliseconds- Returns:
trueif the operation is completed.- Throws:
java.io.IOException- if failed - specificallyInterruptedIOExceptionif waiting was interrupted
-
await
boolean await(long timeoutMillis, CancelOption... options) throws java.io.IOExceptionWait for the asynchronous operation to complete with the specified timeout.- Parameters:
timeoutMillis- Wait time in millisecondsoptions- OptionalCancelOptions defining the behavior on time-out or interrupt; ignored if the future is notCancellable.- Returns:
trueif the operation is completed.- Throws:
java.io.IOException- if failed - specificallyInterruptedIOExceptionif waiting was interrupted
-
awaitUninterruptibly
default boolean awaitUninterruptibly()
WaitLong.MAX_VALUEmsec. for the asynchronous operation to complete uninterruptibly. The attached listeners will be notified when the operation is completed.- Returns:
trueif the operation is completed.- See Also:
awaitUninterruptibly(long, CancelOption[])
-
awaitUninterruptibly
default boolean awaitUninterruptibly(CancelOption... options)
WaitLong.MAX_VALUEmsec. for the asynchronous operation to complete uninterruptibly. The attached listeners will be notified when the operation is completed.- Parameters:
options- OptionalCancelOptions defining the behavior on time-out; ignored if the future is notCancellable.- Returns:
trueif the operation is completed.- See Also:
awaitUninterruptibly(long, CancelOption[])
-
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- TheTimeUnitfor waiting- Returns:
trueif the operation is completed.- See Also:
awaitUninterruptibly(long, CancelOption[])
-
awaitUninterruptibly
default boolean awaitUninterruptibly(long timeout, java.util.concurrent.TimeUnit unit, CancelOption... options)Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.- Parameters:
timeout- The number of time units to waitunit- TheTimeUnitfor waitingoptions- OptionalCancelOptions defining the behavior on time-out; ignored if the future is notCancellable.- Returns:
trueif the operation is completed.- See Also:
awaitUninterruptibly(long, CancelOption[])
-
awaitUninterruptibly
default boolean awaitUninterruptibly(java.time.Duration timeoutMillis)
Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.- Parameters:
timeoutMillis- Wait time,nullto wait forever- Returns:
trueif the operation is finished.
-
awaitUninterruptibly
default boolean awaitUninterruptibly(java.time.Duration timeoutMillis, CancelOption... options)Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.- Parameters:
timeoutMillis- Wait time,nullto wait foreveroptions- OptionalCancelOptions defining the behavior on time-out; ignored if the future is notCancellable.- Returns:
trueif the operation is finished.
-
awaitUninterruptibly
default boolean awaitUninterruptibly(long timeoutMillis)
Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.- Parameters:
timeoutMillis- Wait time in milliseconds- Returns:
trueif the operation is finished.
-
awaitUninterruptibly
boolean awaitUninterruptibly(long timeoutMillis, CancelOption... options)Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.- Parameters:
timeoutMillis- Wait time in millisecondsoptions- OptionalCancelOptions defining the behavior on time-out; ignored if the future is notCancellable.- Returns:
trueif the operation is finished.
-
isDone
boolean isDone()
- Returns:
trueif the asynchronous operation is completed. Note: it is up to the caller to determine whether it was a successful or failed completion.
-
-