Package org.apache.mina.core.future
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 IoFutureRepresents the completion of an asynchronous I/O operation on anIoSession. Can be listened for completion using aIoFutureListener.- Author:
- Apache MINA Project
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description IoFutureaddListener(IoFutureListener<?> listener)Adds an eventlistenerwhich is notified when this future is completed.IoFutureawait()Wait for the asynchronous operation to complete.booleanawait(long timeoutMillis)Wait for the asynchronous operation to complete with the specified timeout.booleanawait(long timeout, TimeUnit unit)Wait for the asynchronous operation to complete with the specified timeout.IoFutureawaitUninterruptibly()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.IoSessiongetSession()booleanisDone()voidjoin()Deprecated.Replaced withawaitUninterruptibly().booleanjoin(long timeoutMillis)Deprecated.Replaced withawaitUninterruptibly(long).IoFutureremoveListener(IoFutureListener<?> listener)Removes an existing eventlistenerso it won't be notified when the future is completed.
-
-
-
Method Detail
-
await
IoFuture await() throws InterruptedException
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
boolean await(long timeout, TimeUnit unit) throws InterruptedExceptionWait 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
boolean await(long timeoutMillis) throws InterruptedExceptionWait 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
boolean awaitUninterruptibly(long timeout, TimeUnit unit)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 void join()
Deprecated.Replaced withawaitUninterruptibly().
-
join
@Deprecated boolean join(long timeoutMillis)
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
IoFuture addListener(IoFutureListener<?> listener)
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
IoFuture removeListener(IoFutureListener<?> listener)
Removes an existing eventlistenerso it won't be notified when the future is completed.- Parameters:
listener- The listener to remove- Returns:
- the current IoFuture
-
-