Class DefaultCloseFuture
java.lang.Object
org.apache.mina.core.future.DefaultIoFuture
org.apache.mina.core.future.DefaultCloseFuture
- All Implemented Interfaces:
CloseFuture, IoFuture
A default implementation of
CloseFuture.-
Constructor Summary
Constructors -
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.Wait for the asynchronous operation to complete uninterruptibly.booleanisClosed()removeListener(IoFutureListener<?> listener) Removes an existing eventlistenerso it won't be notified when the future is completed.voidMarks this future as closed and notifies all threads waiting for this future.Methods inherited from class DefaultIoFuture
await, await, awaitUninterruptibly, awaitUninterruptibly, getSession, getValue, isDone, join, join, setValueMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IoFuture
await, await, awaitUninterruptibly, awaitUninterruptibly, getSession, isDone, join, join
-
Constructor Details
-
DefaultCloseFuture
Creates a new instance.- Parameters:
session- The associated session
-
-
Method Details
-
isClosed
public boolean isClosed()- Specified by:
isClosedin interfaceCloseFuture- Returns:
trueif the close request is finished and the session is closed.
-
setClosed
public 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.- Specified by:
setClosedin interfaceCloseFuture
-
await
Wait for the asynchronous operation to complete. The attached listeners will be notified when the operation is completed.- Specified by:
awaitin interfaceCloseFuture- Specified by:
awaitin interfaceIoFuture- Overrides:
awaitin classDefaultIoFuture- Returns:
- The instance of IoFuture that we are waiting for
- Throws:
InterruptedException- If the thread is interrupted while waiting
-
awaitUninterruptibly
Wait for the asynchronous operation to complete uninterruptibly. The attached listeners will be notified when the operation is completed.- Specified by:
awaitUninterruptiblyin interfaceCloseFuture- Specified by:
awaitUninterruptiblyin interfaceIoFuture- Overrides:
awaitUninterruptiblyin classDefaultIoFuture- Returns:
- the current IoFuture
-
addListener
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 interfaceCloseFuture- Specified by:
addListenerin interfaceIoFuture- Overrides:
addListenerin classDefaultIoFuture- 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.- Specified by:
removeListenerin interfaceCloseFuture- Specified by:
removeListenerin interfaceIoFuture- Overrides:
removeListenerin classDefaultIoFuture- Parameters:
listener- The listener to remove- Returns:
- the current IoFuture
-