geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jche...@apache.org
Subject incubator-geode git commit: GEODE-77: Fix unable to allocate a failure detection port in the membership-port range
Date Thu, 12 Nov 2015 23:55:41 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-77 21274f9c9 -> 4addcea05


GEODE-77: Fix unable to allocate a failure detection port in the membership-port range


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

Branch: refs/heads/feature/GEODE-77
Commit: 4addcea057a22e1f1c5f131f8bc1f2f42a04fe4b
Parents: 21274f9
Author: Jianxia Chen <jchen@pivotal.io>
Authored: Thu Nov 12 15:49:37 2015 -0800
Committer: Jianxia Chen <jchen@pivotal.io>
Committed: Thu Nov 12 15:53:01 2015 -0800

----------------------------------------------------------------------
 .../internal/membership/gms/fd/GMSHealthMonitor.java     | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4addcea0/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
index b9ec83a..84eca62 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
@@ -10,7 +10,6 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.InetAddress;
-import java.net.InetSocketAddress;
 import java.net.ServerSocket;
 import java.net.Socket;
 import java.net.SocketTimeoutException;
@@ -41,7 +40,6 @@ import org.jgroups.util.UUID;
 
 import com.gemstone.gemfire.CancelException;
 import com.gemstone.gemfire.GemFireConfigException;
-import com.gemstone.gemfire.SystemConnectException;
 import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.distributed.DistributedSystemDisconnectedException;
 import com.gemstone.gemfire.distributed.internal.DistributionMessage;
@@ -55,7 +53,6 @@ import com.gemstone.gemfire.distributed.internal.membership.gms.messages.Heartbe
 import com.gemstone.gemfire.distributed.internal.membership.gms.messages.HeartbeatRequestMessage;
 import com.gemstone.gemfire.distributed.internal.membership.gms.messages.SuspectMembersMessage;
 import com.gemstone.gemfire.distributed.internal.membership.gms.messages.SuspectRequest;
-import com.gemstone.gemfire.internal.AvailablePort;
 import com.gemstone.gemfire.internal.ConnectionWatcher;
 import com.gemstone.gemfire.internal.SocketCreator;
 import com.gemstone.gemfire.internal.Version;
@@ -614,13 +611,9 @@ public class GMSHealthMonitor implements HealthMonitor, MessageHandler
{
     // socket port and joining the system
     socketAddress = localAddress.getInetAddress();
     int[] portRange = services.getConfig().getMembershipPortRange();            
-    socketPort = AvailablePort.getAvailablePortInRange(portRange[0], portRange[1], AvailablePort.SOCKET);
-    if (socketPort == -1) {
-      throw new SystemConnectException("Unable to find a free port in the membership port
range");
-    }
     try {
-      serverSocket = new ServerSocket();
-      serverSocket.bind(new InetSocketAddress(socketAddress, socketPort));
+      serverSocket = SocketCreator.getDefaultInstance().createServerSocketUsingPortRange(socketAddress,
50/*backlog*/, true/*isBindAddress*/, false/*useNIO*/, 65536/*tcpBufferSize*/, portRange);
+      socketPort = serverSocket.getLocalPort();
     } catch (IOException e) {
       throw new GemFireConfigException("Unable to allocate a failure detection port in the
membership-port range", e);
     }


Mime
View raw message