Repository: mina Updated Branches: refs/heads/2.0 f1972fc3d -> bdad876b2
Updated the Javadoc, adding the missing one Project: http://git-wip-us.apache.org/repos/asf/mina/repo Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/4adb1cd6 Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/4adb1cd6 Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/4adb1cd6 Branch: refs/heads/2.0 Commit: 4adb1cd61befe56c740cad215ddd9553ad61ffb3 Parents: f1972fc Author: Emmanuel Lécharny <[email protected]> Authored: Tue Nov 4 14:38:00 2014 +0100 Committer: Emmanuel Lécharny <[email protected]> Committed: Tue Nov 4 14:38:00 2014 +0100 ---------------------------------------------------------------------- .../apache/mina/core/future/CloseFuture.java | 18 +++++++++-- .../apache/mina/core/future/ConnectFuture.java | 2 +- .../org/apache/mina/core/future/ReadFuture.java | 33 +++++++++++++++----- .../apache/mina/core/future/WriteFuture.java | 12 ++++--- 4 files changed, 51 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mina/blob/4adb1cd6/mina-core/src/main/java/org/apache/mina/core/future/CloseFuture.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/core/future/CloseFuture.java b/mina-core/src/main/java/org/apache/mina/core/future/CloseFuture.java index 0723e61..0235c03 100644 --- a/mina-core/src/main/java/org/apache/mina/core/future/CloseFuture.java +++ b/mina-core/src/main/java/org/apache/mina/core/future/CloseFuture.java @@ -26,8 +26,10 @@ package org.apache.mina.core.future; * <pre> * IoSession session = ...; * CloseFuture future = session.close(true); + * * // Wait until the connection is closed * future.awaitUninterruptibly(); + * * // Now connection should be closed. * assert future.isClosed(); * </pre> @@ -36,22 +38,34 @@ package org.apache.mina.core.future; */ public interface CloseFuture extends IoFuture { /** - * Returns <tt>true</tt> if the close request is finished and the session is closed. + * @return <tt>true</tt> if the close request is finished and the session is closed. */ boolean isClosed(); /** * Marks this future as closed and notifies all threads waiting for this - * future. This method is invoked by MINA internally. Please do not call + * future. This method is invoked by MINA internally. Please do not call * this method directly. */ void setClosed(); + /** + * {@inheritDoc} + */ CloseFuture await() throws InterruptedException; + /** + * {@inheritDoc} + */ CloseFuture awaitUninterruptibly(); + /** + * {@inheritDoc} + */ CloseFuture addListener(IoFutureListener<?> listener); + /** + * {@inheritDoc} + */ CloseFuture removeListener(IoFutureListener<?> listener); } http://git-wip-us.apache.org/repos/asf/mina/blob/4adb1cd6/mina-core/src/main/java/org/apache/mina/core/future/ConnectFuture.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/core/future/ConnectFuture.java b/mina-core/src/main/java/org/apache/mina/core/future/ConnectFuture.java index a1bc093..5eae6a9 100644 --- a/mina-core/src/main/java/org/apache/mina/core/future/ConnectFuture.java +++ b/mina-core/src/main/java/org/apache/mina/core/future/ConnectFuture.java @@ -28,7 +28,7 @@ import org.apache.mina.core.session.IoSession; * <pre> * IoConnector connector = ...; * ConnectFuture future = connector.connect(...); - * future.await(); // Wait until the connection attempt is finished. + * future.awaitUninterruptibly(); // Wait until the connection attempt is finished. * IoSession session = future.getSession(); * session.write(...); * </pre> http://git-wip-us.apache.org/repos/asf/mina/blob/4adb1cd6/mina-core/src/main/java/org/apache/mina/core/future/ReadFuture.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/core/future/ReadFuture.java b/mina-core/src/main/java/org/apache/mina/core/future/ReadFuture.java index b14e06a..1f03523 100644 --- a/mina-core/src/main/java/org/apache/mina/core/future/ReadFuture.java +++ b/mina-core/src/main/java/org/apache/mina/core/future/ReadFuture.java @@ -27,12 +27,15 @@ import org.apache.mina.core.session.IoSession; * <h3>Example</h3> * <pre> * IoSession session = ...; + * * // useReadOperation must be enabled to use read operation. * session.getConfig().setUseReadOperation(true); * * ReadFuture future = session.read(); + * * // Wait until a message is received. - * future.await(); + * future.awaitUninterruptibly(); + * * try { * Object message = future.getMessage(); * } catch (Exception e) { @@ -45,26 +48,26 @@ import org.apache.mina.core.session.IoSession; public interface ReadFuture extends IoFuture { /** - * Returns the received message. It returns <tt>null</tt> if this - * future is not ready or the associated {@link IoSession} has been closed. + * Get the read message. * - * @throws RuntimeException if read or any relevant operation has failed. + * @return the received message. It returns <tt>null</tt> if this + * future is not ready or the associated {@link IoSession} has been closed. */ Object getMessage(); /** - * Returns <tt>true</tt> if a message was received successfully. + * @return <tt>true</tt> if a message was received successfully. */ boolean isRead(); /** - * Returns <tt>true</tt> if the {@link IoSession} associated with this + * @return <tt>true</tt> if the {@link IoSession} associated with this * future has been closed. */ boolean isClosed(); /** - * Returns the cause of the read failure if and only if the read + * @return the cause of the read failure if and only if the read * operation has failed due to an {@link Exception}. Otherwise, * <tt>null</tt> is returned. */ @@ -74,6 +77,8 @@ public interface ReadFuture extends IoFuture { * Sets the message is written, and notifies all threads waiting for * this future. This method is invoked by MINA internally. Please do * not call this method directly. + * + * @param message The received message to store in this future */ void setRead(Object message); @@ -87,14 +92,28 @@ public interface ReadFuture extends IoFuture { * Sets the cause of the read failure, and notifies all threads waiting * for this future. This method is invoked by MINA internally. Please * do not call this method directly. + * + * @param cause The exception to store in the Future instance */ void setException(Throwable cause); + /** + * {@inheritDoc} + */ ReadFuture await() throws InterruptedException; + /** + * {@inheritDoc} + */ ReadFuture awaitUninterruptibly(); + /** + * {@inheritDoc} + */ ReadFuture addListener(IoFutureListener<?> listener); + /** + * {@inheritDoc} + */ ReadFuture removeListener(IoFutureListener<?> listener); } http://git-wip-us.apache.org/repos/asf/mina/blob/4adb1cd6/mina-core/src/main/java/org/apache/mina/core/future/WriteFuture.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/core/future/WriteFuture.java b/mina-core/src/main/java/org/apache/mina/core/future/WriteFuture.java index a8ef241..8991b37 100644 --- a/mina-core/src/main/java/org/apache/mina/core/future/WriteFuture.java +++ b/mina-core/src/main/java/org/apache/mina/core/future/WriteFuture.java @@ -26,15 +26,17 @@ package org.apache.mina.core.future; * <pre> * IoSession session = ...; * WriteFuture future = session.write(...); + * * // Wait until the message is completely written out to the O/S buffer. - * future.join(); + * future.awaitUninterruptibly(); + * * if( future.isWritten() ) * { * // The message has been written successfully. * } * else * { - * // The messsage couldn't be written out completely for some reason. + * // The message couldn't be written out completely for some reason. * // (e.g. Connection is closed) * } * </pre> @@ -43,12 +45,12 @@ package org.apache.mina.core.future; */ public interface WriteFuture extends IoFuture { /** - * Returns <tt>true</tt> if the write operation is finished successfully. + * @return <tt>true</tt> if the write operation is finished successfully. */ boolean isWritten(); /** - * Returns the cause of the write failure if and only if the write + * @return the cause of the write failure if and only if the write * operation has failed due to an {@link Exception}. Otherwise, * <tt>null</tt> is returned. */ @@ -65,6 +67,8 @@ public interface WriteFuture extends IoFuture { * Sets the cause of the write failure, and notifies all threads waiting * for this future. This method is invoked by MINA internally. Please * do not call this method directly. + * + * @param cause The exception to store in the Future instance */ void setException(Throwable cause);
