Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

changed port allocation

  • Loading branch information...
commit 82786454cb89ab87c2bfa0cffb84d207fed22a8b 1 parent d74ac8d
@belaban authored
Showing with 3 additions and 8 deletions.
  1. +3 −8 src/org/jgroups/util/ResourceManager.java
View
11 src/org/jgroups/util/ResourceManager.java
@@ -58,22 +58,18 @@ public static String getNextMulticastAddress() {
}
public static synchronized short getNextMulticastPort(InetAddress bind_addr) throws Exception {
- short port = mcast_port++;
+ short port = mcast_port;
try {
DatagramSocket sock = Util.createDatagramSocket(socket_factory, "jgroups.temp.resourcemgr.mcast_sock", bind_addr, port);
port = (short) sock.getLocalPort();
socket_factory.close(sock);
- ServerSocket srv_sock = Util.createServerSocket(socket_factory, "jgroups.temp.resourcemgr.srv_sock", bind_addr, port);
- port = (short) srv_sock.getLocalPort();
- socket_factory.close(srv_sock);
return port;
} finally {
mcast_port = (short) (port + 1);
}
}
- public static synchronized List<Short> getNextTcpPorts(
- InetAddress bind_addr, int num_requested_ports) throws Exception {
+ public static synchronized List<Short> getNextTcpPorts(InetAddress bind_addr, int num_requested_ports) throws Exception {
short port = tcp_port++;
List<Short> retval = new ArrayList<Short>(num_requested_ports);
@@ -97,8 +93,7 @@ public static String getUniqueClusterName() {
}
public static void main(String[] args) throws Exception {
- List<Short> ports = getNextTcpPorts(InetAddress
- .getByName("192.168.1.5"), 15);
+ List<Short> ports = getNextTcpPorts(InetAddress.getByName("192.168.1.5"), 15);
System.out.println("ports = " + ports);
ports = getNextTcpPorts(InetAddress.getByName("192.168.1.5"), 5);
Please sign in to comment.
Something went wrong with that request. Please try again.