Class EndlessWriteFuture
- java.lang.Object
-
- org.apache.sshd.contrib.common.io.EndlessWriteFuture
-
- All Implemented Interfaces:
HasException,SshFuture<IoWriteFuture>,VerifiableFuture<IoWriteFuture>,WaitableFuture,IoWriteFuture
public class EndlessWriteFuture extends java.lang.Object implements IoWriteFuture
Never signals a successful write completion and ignores all listeners
-
-
Field Summary
Fields Modifier and Type Field Description static EndlessWriteFutureINSTANCE
-
Constructor Summary
Constructors Constructor Description EndlessWriteFuture()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IoWriteFutureaddListener(SshFutureListener<IoWriteFuture> listener)Adds an event listener which is notified when this future is completed.booleanawait(long timeoutMillis, CancelOption... options)Wait for the asynchronous operation to complete with the specified timeout.booleanawaitUninterruptibly(long timeoutMillis, CancelOption... options)Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.java.lang.ThrowablegetException()Returns the cause of the failure.java.lang.ObjectgetId()booleanisDone()booleanisWritten()IoWriteFutureremoveListener(SshFutureListener<IoWriteFuture> listener)Removes an existing event listener so it won't be notified when the future is completed.IoWriteFutureverify(long timeoutMillis, CancelOption... options)Wait and verify that the operation was successful-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.future.VerifiableFuture
verify, verify, verify, verify, verify, verify, verify
-
Methods inherited from interface org.apache.sshd.common.future.WaitableFuture
await, await, await, await, await, await, await, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly
-
-
-
-
Field Detail
-
INSTANCE
public static final EndlessWriteFuture INSTANCE
-
-
Method Detail
-
verify
public IoWriteFuture verify(long timeoutMillis, CancelOption... options) throws java.io.IOException
Description copied from interface:VerifiableFutureWait and verify that the operation was successful- Specified by:
verifyin interfaceVerifiableFuture<IoWriteFuture>- Parameters:
timeoutMillis- Wait timeout in millisecondsoptions- OptionalCancelOptions defining the behavior on time-out or interrupt; ignored if the future is notCancellable.- Returns:
- The (same) future instance
- Throws:
java.io.IOException- If failed to verify successfully on time
-
isDone
public boolean isDone()
- Specified by:
isDonein interfaceWaitableFuture- Returns:
trueif the asynchronous operation is completed. Note: it is up to the caller to determine whether it was a successful or failed completion.
-
getId
public java.lang.Object getId()
- Specified by:
getIdin interfaceWaitableFuture- Returns:
- Some identifier useful as
toString()value
-
awaitUninterruptibly
public boolean awaitUninterruptibly(long timeoutMillis, CancelOption... options)Description copied from interface:WaitableFutureWait for the asynchronous operation to complete with the specified timeout uninterruptibly.- Specified by:
awaitUninterruptiblyin interfaceWaitableFuture- 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.
-
await
public boolean await(long timeoutMillis, CancelOption... options) throws java.io.IOExceptionDescription copied from interface:WaitableFutureWait for the asynchronous operation to complete with the specified timeout.- Specified by:
awaitin interfaceWaitableFuture- 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
-
removeListener
public IoWriteFuture removeListener(SshFutureListener<IoWriteFuture> listener)
Description copied from interface:SshFutureRemoves an existing event listener so it won't be notified when the future is completed.- Specified by:
removeListenerin interfaceSshFuture<IoWriteFuture>- Parameters:
listener- TheSshFutureListenerinstance to remove- Returns:
- The future instance
-
addListener
public IoWriteFuture addListener(SshFutureListener<IoWriteFuture> listener)
Description copied from interface:SshFutureAdds an event listener which is notified when this future is completed. If the listener is added after the completion, the listener is directly notified.- Specified by:
addListenerin interfaceSshFuture<IoWriteFuture>- Parameters:
listener- TheSshFutureListenerinstance to add- Returns:
- The future instance
-
isWritten
public boolean isWritten()
- Specified by:
isWrittenin interfaceIoWriteFuture- Returns:
- true if the write operation is finished successfully.
-
getException
public java.lang.Throwable getException()
Description copied from interface:HasExceptionReturns the cause of the failure.- Specified by:
getExceptionin interfaceHasException- Returns:
- the
Throwableof the failure, ornullif not failed (yet).
-
-