Package org.apache.mina.core.future
Interface CloseFuture
-
- All Superinterfaces:
IoFuture
- All Known Implementing Classes:
DefaultCloseFuture
public interface CloseFuture extends IoFuture
AnIoFuturefor asynchronous close requests.Example
IoSession session = ...; CloseFuture future = session.close(true); // Wait until the connection is closed future.awaitUninterruptibly(); // Now connection should be closed. assert future.isClosed();
- Author:
- Apache MINA Project
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CloseFutureaddListener(IoFutureListener<?> listener)Adds an eventlistenerwhich is notified when this future is completed.CloseFutureawait()Wait for the asynchronous operation to complete.CloseFutureawaitUninterruptibly()Wait for the asynchronous operation to complete uninterruptibly.booleanisClosed()CloseFutureremoveListener(IoFutureListener<?> listener)Removes an existing eventlistenerso it won't be notified when the future is completed.voidsetClosed()Marks this future as closed and notifies all threads waiting for this future.-
Methods inherited from interface org.apache.mina.core.future.IoFuture
await, await, awaitUninterruptibly, awaitUninterruptibly, getSession, isDone, join, join
-
-
-
-
Method Detail
-
isClosed
boolean isClosed()
- Returns:
trueif the close request is finished and the session is closed.
-
setClosed
void setClosed()
Marks this future as closed and notifies all threads waiting for this future. This method is invoked by MINA internally. Please do not call this method directly.
-
await
CloseFuture await() throws InterruptedException
Wait for the asynchronous operation to complete. The attached listeners will be notified when the operation is completed.- Specified by:
awaitin interfaceIoFuture- Returns:
- The instance of IoFuture that we are waiting for
- Throws:
InterruptedException- If the thread is interrupted while waiting
-
awaitUninterruptibly
CloseFuture awaitUninterruptibly()
Wait for the asynchronous operation to complete uninterruptibly. The attached listeners will be notified when the operation is completed.- Specified by:
awaitUninterruptiblyin interfaceIoFuture- Returns:
- the current IoFuture
-
addListener
CloseFuture 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.- Specified by:
addListenerin interfaceIoFuture- Parameters:
listener- The listener to add- Returns:
- the current IoFuture
-
removeListener
CloseFuture removeListener(IoFutureListener<?> listener)
Removes an existing eventlistenerso it won't be notified when the future is completed.- Specified by:
removeListenerin interfaceIoFuture- Parameters:
listener- The listener to remove- Returns:
- the current IoFuture
-
-