You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by el...@apache.org on 2016/08/19 05:37:29 UTC

mina git commit: o Use the first available port instead of searching for one o Fixed a typo

Repository: mina
Updated Branches:
  refs/heads/2.0 6286aeaaa -> ce6d3e933


o Use the first available port instead of searching for one
o Fixed a typo 

Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/ce6d3e93
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/ce6d3e93
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/ce6d3e93

Branch: refs/heads/2.0
Commit: ce6d3e933584824948d1da30ee1bd466307b6f03
Parents: 6286aea
Author: Emmanuel L�charny <el...@symas.com>
Authored: Thu Aug 18 18:13:00 2016 +0200
Committer: Emmanuel L�charny <el...@symas.com>
Committed: Thu Aug 18 18:13:00 2016 +0200

----------------------------------------------------------------------
 .../apache/mina/core/future/DefaultIoFuture.java |  2 +-
 .../apache/mina/transport/AbstractBindTest.java  | 19 +++++++++----------
 2 files changed, 10 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina/blob/ce6d3e93/mina-core/src/main/java/org/apache/mina/core/future/DefaultIoFuture.java
----------------------------------------------------------------------
diff --git a/mina-core/src/main/java/org/apache/mina/core/future/DefaultIoFuture.java b/mina-core/src/main/java/org/apache/mina/core/future/DefaultIoFuture.java
index e71edb1..18b1506 100644
--- a/mina-core/src/main/java/org/apache/mina/core/future/DefaultIoFuture.java
+++ b/mina-core/src/main/java/org/apache/mina/core/future/DefaultIoFuture.java
@@ -307,7 +307,7 @@ public class DefaultIoFuture implements IoFuture {
             result = newValue;
             ready = true;
             
-            // Now, if we have waiters, notofy them that the operation has completed
+            // Now, if we have waiters, notify them that the operation has completed
             if (waiters > 0) {
                 lock.notifyAll();
             }

http://git-wip-us.apache.org/repos/asf/mina/blob/ce6d3e93/mina-core/src/test/java/org/apache/mina/transport/AbstractBindTest.java
----------------------------------------------------------------------
diff --git a/mina-core/src/test/java/org/apache/mina/transport/AbstractBindTest.java b/mina-core/src/test/java/org/apache/mina/transport/AbstractBindTest.java
index a1c3d98..ba980b6 100644
--- a/mina-core/src/test/java/org/apache/mina/transport/AbstractBindTest.java
+++ b/mina-core/src/test/java/org/apache/mina/transport/AbstractBindTest.java
@@ -41,6 +41,7 @@ import org.apache.mina.transport.socket.DatagramAcceptor;
 import org.apache.mina.transport.socket.DatagramSessionConfig;
 import org.apache.mina.transport.socket.SocketAcceptor;
 import org.apache.mina.transport.socket.SocketSessionConfig;
+import org.apache.mina.util.AvailablePortFinder;
 import org.junit.After;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -78,16 +79,14 @@ public abstract class AbstractBindTest {
         // Let's start from port #1 to detect possible resource leak
         // because test will fail in port 1-1023 if user run this test
         // as a normal user.
-        for (port = 1024; port <= 65535; port++) {
-            socketBound = false;
-            try {
-                acceptor.setDefaultLocalAddress(createSocketAddress(port));
-                acceptor.bind();
-                socketBound = true;
-                break;
-            } catch (IOException e) {
-                //System.out.println(e.getMessage());
-            }
+        port = AvailablePortFinder.getNextAvailable();
+        socketBound = false;
+        try {
+            acceptor.setDefaultLocalAddress(createSocketAddress(port));
+            acceptor.bind();
+            socketBound = true;
+        } catch (IOException e) {
+            //System.out.println(e.getMessage());
         }
 
         // If there is no port available, test fails.