[prev in list] [next in list] [prev in thread] [next in thread]
List: mina-commits
Subject: [3/4] git commit: Updated the Javadoc, adding the missing ones
From: elecharny () apache ! org
Date: 2014-11-04 13:22:32
Message-ID: 9240bc3242a1440d84c8b5bdd875cfd8 () git ! apache ! org
[Download RAW message or body]
Updated the Javadoc, adding the missing ones
Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/32945a91
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/32945a91
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/32945a91
Branch: refs/heads/2.0
Commit: 32945a919d9e110296c638c6405db7928ed9f739
Parents: 92183f8
Author: Emmanuel Lécharny <elecharny@symas.com>
Authored: Tue Nov 4 11:50:12 2014 +0100
Committer: Emmanuel Lécharny <elecharny@symas.com>
Committed: Tue Nov 4 11:50:12 2014 +0100
----------------------------------------------------------------------
.../apache/mina/core/future/ConnectFuture.java | 3 +-
.../mina/core/future/DefaultConnectFuture.java | 63 ++++++++++++++++----
2 files changed, 54 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mina/blob/32945a91/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 \
0e18626..2db17c3 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
@@ -39,7 +39,8 @@ public interface ConnectFuture extends IoFuture {
/**
* Returns {@link IoSession} which is the result of connect operation.
*
- * @return {@code true} if the connect operation is not finished yet
+ * @return The {link IoSession} instance that has been associated with the \
connection, + * if the connection was successful, {@code null} otherwise
*/
IoSession getSession();
http://git-wip-us.apache.org/repos/asf/mina/blob/32945a91/mina-core/src/main/java/org/apache/mina/core/future/DefaultConnectFuture.java
----------------------------------------------------------------------
diff --git a/mina-core/src/main/java/org/apache/mina/core/future/DefaultConnectFuture.java \
b/mina-core/src/main/java/org/apache/mina/core/future/DefaultConnectFuture.java index \
7b486e4..4d283fd 100644
--- a/mina-core/src/main/java/org/apache/mina/core/future/DefaultConnectFuture.java
+++ b/mina-core/src/main/java/org/apache/mina/core/future/DefaultConnectFuture.java
@@ -28,43 +28,55 @@ import org.apache.mina.core.session.IoSession;
* @author <a href="http://mina.apache.org">Apache MINA Project</a>
*/
public class DefaultConnectFuture extends DefaultIoFuture implements ConnectFuture {
-
+ /** A static object stored into the ConnectFuture when teh connection has been \
cancelled */ private static final Object CANCELED = new Object();
/**
- * Returns a new {@link ConnectFuture} which is already marked as 'failed to \
connect'. + * Creates a new instance.
+ */
+ public DefaultConnectFuture() {
+ super(null);
+ }
+
+ /**
+ * Creates a new instance of a Connection Failure, with the associated cause.
+ *
+ * @param exception The exception that caused the failure
+ * @return a new {@link ConnectFuture} which is already marked as 'failed to \
connect'.
*/
public static ConnectFuture newFailedFuture(Throwable exception) {
DefaultConnectFuture failedFuture = new DefaultConnectFuture();
failedFuture.setException(exception);
+
return failedFuture;
}
/**
- * Creates a new instance.
+ * {@inheritDoc}
*/
- public DefaultConnectFuture() {
- super(null);
- }
-
@Override
public IoSession getSession() {
Object v = getValue();
- if (v instanceof RuntimeException) {
+
+ if (v instanceof IoSession) {
+ return (IoSession) v;
+ } else if (v instanceof RuntimeException) {
throw (RuntimeException) v;
} else if (v instanceof Error) {
throw (Error) v;
} else if (v instanceof Throwable) {
throw (RuntimeIoException) new RuntimeIoException("Failed to get the \
session.").initCause((Throwable) v);
- } else if (v instanceof IoSession) {
- return (IoSession) v;
- } else {
+ } else {
return null;
}
}
+ /**
+ * {@inheritDoc}
+ */
public Throwable getException() {
Object v = getValue();
+
if (v instanceof Throwable) {
return (Throwable) v;
} else {
@@ -72,47 +84,76 @@ public class DefaultConnectFuture extends DefaultIoFuture \
implements ConnectFutu }
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isConnected() {
return getValue() instanceof IoSession;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isCanceled() {
return getValue() == CANCELED;
}
+ /**
+ * {@inheritDoc}
+ */
public void setSession(IoSession session) {
if (session == null) {
throw new IllegalArgumentException("session");
}
+
setValue(session);
}
+ /**
+ * {@inheritDoc}
+ */
public void setException(Throwable exception) {
if (exception == null) {
throw new IllegalArgumentException("exception");
}
+
setValue(exception);
}
+ /**
+ * {@inheritDoc}
+ */
public void cancel() {
setValue(CANCELED);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public ConnectFuture await() throws InterruptedException {
return (ConnectFuture) super.await();
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public ConnectFuture awaitUninterruptibly() {
return (ConnectFuture) super.awaitUninterruptibly();
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public ConnectFuture addListener(IoFutureListener<?> listener) {
return (ConnectFuture) super.addListener(listener);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public ConnectFuture removeListener(IoFutureListener<?> listener) {
return (ConnectFuture) super.removeListener(listener);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic