You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by nn...@apache.org on 2016/07/13 20:45:34 UTC

incubator-geode git commit: GEODE-1639: Receivers selects a different port if the selected port is in use.

Repository: incubator-geode
Updated Branches:
  refs/heads/develop c4cf82101 -> 23211ddca


GEODE-1639: Receivers selects a different port if the selected port is in use.

	* If the selected port is in use then the receiver will select another port between 20001 and 29999
	This closes #194


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/23211ddc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/23211ddc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/23211ddc

Branch: refs/heads/develop
Commit: 23211ddcaf9a6be719ba9f1915a6ca862a2eef71
Parents: c4cf821
Author: nabarun <nn...@pivotal.io>
Authored: Wed Jul 6 16:34:03 2016 -0700
Committer: nabarun <nn...@pivotal.io>
Committed: Wed Jul 13 13:45:15 2016 -0700

----------------------------------------------------------------------
 .../gemstone/gemfire/internal/AvailablePort.java    |  7 ++++---
 .../cache/wan/wancommand/WANCommandTestBase.java    | 16 ++++++++--------
 2 files changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/23211ddc/geode-core/src/main/java/com/gemstone/gemfire/internal/AvailablePort.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/AvailablePort.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/AvailablePort.java
index 95ca22b..5fa826f 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/AvailablePort.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/AvailablePort.java
@@ -33,7 +33,8 @@ public class AvailablePort {
 
   /** Is the port available for a Socket (TCP) connection? */
   public static final int SOCKET = 0;
-
+  public static final int AVAILABLE_PORTS_LOWER_BOUND = 20001;// 20000/udp is securid
+  public static final int AVAILABLE_PORTS_UPPER_BOUND = 29999;//30000/tcp is spoolfax
   /** Is the port available for a JGroups (UDP) multicast connection */
   public static final int MULTICAST = 1;
 
@@ -434,8 +435,8 @@ public class AvailablePort {
 //       rangeBase=1024;
 //       rangeTop=5000;
 //     }
-    rangeBase = 20001; // 20000/udp is securid
-    rangeTop =  29999; // 30000/tcp is spoolfax
+    rangeBase = AVAILABLE_PORTS_LOWER_BOUND; // 20000/udp is securid
+    rangeTop =  AVAILABLE_PORTS_UPPER_BOUND; // 30000/tcp is spoolfax
 
     return rand.nextInt(rangeTop-rangeBase) + rangeBase;
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/23211ddc/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WANCommandTestBase.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WANCommandTestBase.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WANCommandTestBase.java
index af72ed1..ec38b31 100644
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WANCommandTestBase.java
+++ b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WANCommandTestBase.java
@@ -25,6 +25,7 @@ import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
 import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.distributed.Locator;
 import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.internal.AvailablePort;
 import com.gemstone.gemfire.internal.AvailablePortHelper;
 import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
 import com.gemstone.gemfire.management.ManagementService;
@@ -230,12 +231,11 @@ public abstract class WANCommandTestBase extends CliCommandTestBase {
     InternalDistributedSystem ds = getSystem(props);
     cache = CacheFactory.create(ds);
     GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    fact.setStartPort(port);
-    fact.setEndPort(port);
+    fact.setStartPort(AvailablePort.AVAILABLE_PORTS_LOWER_BOUND);
+    fact.setEndPort(AvailablePort.AVAILABLE_PORTS_UPPER_BOUND);
     fact.setManualStart(true);
     GatewayReceiver receiver = fact.create();
-    return port;
+    return receiver.getPort();
   }
 
   public int createReceiverWithGroup(int locPort, String groups) {
@@ -248,12 +248,12 @@ public abstract class WANCommandTestBase extends CliCommandTestBase {
     InternalDistributedSystem ds = getSystem(props);
     cache = CacheFactory.create(ds);
     GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
-    int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
-    fact.setStartPort(port);
-    fact.setEndPort(port);
+    fact.setStartPort(AvailablePort.AVAILABLE_PORTS_LOWER_BOUND);
+    fact.setEndPort(AvailablePort.AVAILABLE_PORTS_UPPER_BOUND);
     fact.setManualStart(true);
     GatewayReceiver receiver = fact.create();
-    return port;
+    return receiver.getPort();
+
   }
 
   public void startReceiver() {