Interface IoFuture
- All Known Subinterfaces:
CloseFuture, ConnectFuture, ReadFuture, WriteFuture
- All Known Implementing Classes:
AbstractIoAcceptor.AcceptorOperationFuture, AbstractIoService.ServiceOperationFuture, AbstractPollingIoConnector.ConnectionRequest, CompositeIoFuture, DefaultCloseFuture, DefaultConnectFuture, DefaultIoFuture, DefaultReadFuture, DefaultWriteFuture
public interface IoFuture
Represents the completion of an asynchronous I/O operation on an
IoSession.
Can be listened for completion using a IoFutureListener.-
Method Summary
Modifier and TypeMethodDescriptionaddListener(IoFutureListener<?> listener) Adds an eventlistenerwhich is notified when this future is completed.await()Wait for the asynchronous operation to complete.booleanawait(long timeoutMillis) Wait for the asynchronous operation to complete with the specified timeout.booleanWait for the asynchronous operation to complete with the specified timeout.Wait for the asynchronous operation to complete uninterruptibly.booleanawaitUninterruptibly(long timeoutMillis) Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.booleanawaitUninterruptibly(long timeout, TimeUnit unit) Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.booleanisDone()voidjoin()Deprecated.booleanjoin(long timeoutMillis) Deprecated.Replaced withawaitUninterruptibly(long).removeListener(IoFutureListener<?> listener) Removes an existing eventlistenerso it won't be notified when the future is completed.
-
Method Details
-
getSession
-
await
Wait for the asynchronous operation to complete. The attached listeners will be notified when the operation is completed.- Returns:
- The instance of IoFuture that we are waiting for
- Throws:
InterruptedException- If the thread is interrupted while waiting
-
await
Wait for the asynchronous operation to complete with the specified timeout.- Parameters:
timeout- The maximum delay to wait before getting outunit- the type of unit for the delay (seconds, minutes...)- Returns:
trueif the operation is completed.- Throws:
InterruptedException- If the thread is interrupted while waiting
-
await
Wait for the asynchronous operation to complete with the specified timeout.- Parameters:
timeoutMillis- The maximum milliseconds to wait before getting out- Returns:
trueif the operation is completed.- Throws:
InterruptedException- If the thread is interrupted while waiting
-
awaitUninterruptibly
IoFuture awaitUninterruptibly()Wait for the asynchronous operation to complete uninterruptibly. The attached listeners will be notified when the operation is completed.- Returns:
- the current IoFuture
-
awaitUninterruptibly
Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.- Parameters:
timeout- The maximum delay to wait before getting outunit- the type of unit for the delay (seconds, minutes...)- Returns:
trueif the operation is completed.
-
awaitUninterruptibly
boolean awaitUninterruptibly(long timeoutMillis) Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.- Parameters:
timeoutMillis- The maximum milliseconds to wait before getting out- Returns:
trueif the operation is finished.
-
join
Deprecated.Replaced withawaitUninterruptibly(). -
join
Deprecated.Replaced withawaitUninterruptibly(long).- Parameters:
timeoutMillis- The time to wait for the join before bailing out- Returns:
trueif the join was successful
-
isDone
boolean isDone()- Returns:
trueif the operation is completed.
-
addListener
Adds an eventlistenerwhich is notified when this future is completed. If the listener is added after the completion, the listener is directly notified.- Parameters:
listener- The listener to add- Returns:
- the current IoFuture
-
removeListener
Removes an existing eventlistenerso it won't be notified when the future is completed.- Parameters:
listener- The listener to remove- Returns:
- the current IoFuture
-
awaitUninterruptibly().