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 IoFuture
Represents 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 IoFuture
addListener(IoFutureListener<?> listener)
Adds an eventlistener
which is notified when this future is completed.IoFuture
await()
Wait for the asynchronous operation to complete.boolean
await(long timeoutMillis)
Wait for the asynchronous operation to complete with the specified timeout.boolean
await(long timeout, TimeUnit unit)
Wait for the asynchronous operation to complete with the specified timeout.IoFuture
awaitUninterruptibly()
Wait for the asynchronous operation to complete uninterruptibly.boolean
awaitUninterruptibly(long timeoutMillis)
Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.boolean
awaitUninterruptibly(long timeout, TimeUnit unit)
Wait for the asynchronous operation to complete with the specified timeout uninterruptibly.IoSession
getSession()
boolean
isDone()
void
join()
Deprecated.Replaced withawaitUninterruptibly()
.boolean
join(long timeoutMillis)
Deprecated.Replaced withawaitUninterruptibly(long)
.IoFuture
removeListener(IoFutureListener<?> listener)
Removes an existing eventlistener
so 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 InterruptedException
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:
true
if the operation is completed.- Throws:
InterruptedException
- If the thread is interrupted while waiting
-
await
boolean await(long timeoutMillis) throws InterruptedException
Wait for the asynchronous operation to complete with the specified timeout.- Parameters:
timeoutMillis
- The maximum milliseconds to wait before getting out- Returns:
true
if 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:
true
if 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:
true
if 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:
true
if the join was successful
-
isDone
boolean isDone()
- Returns:
true
if the operation is completed.
-
addListener
IoFuture addListener(IoFutureListener<?> listener)
Adds an eventlistener
which 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 eventlistener
so it won't be notified when the future is completed.- Parameters:
listener
- The listener to remove- Returns:
- the current IoFuture
-
-