diff --git a/conf/tunnel.xml b/conf/tunnel.xml index 2b727daed2..f2feb7bc4e 100644 --- a/conf/tunnel.xml +++ b/conf/tunnel.xml @@ -11,7 +11,7 @@ + port_range="${jgroups.tunnel.port_range:0}"/> diff --git a/src/org/jgroups/protocols/TUNNEL.java b/src/org/jgroups/protocols/TUNNEL.java index 9ed8ad3764..7d60e0e0b3 100644 --- a/src/org/jgroups/protocols/TUNNEL.java +++ b/src/org/jgroups/protocols/TUNNEL.java @@ -122,7 +122,7 @@ public TUNNEL setGossipRouterHosts(String hosts) throws UnknownHostException { // if we get passed value of List#toString() we have to strip [] if(hosts.startsWith("[") && hosts.endsWith("]")) hosts=hosts.substring(1, hosts.length() - 1); - gossip_router_hosts=hosts; //.addAll(Util.parseCommaDelimitedHosts2(hosts, port_range)); + gossip_router_hosts=hosts; return this; } @@ -180,6 +180,10 @@ public void init() throws Exception { super.init(); if(timer == null) throw new Exception("timer cannot be retrieved from protocol stack"); + if(port_range > 0) { + log.warn("%s: port_range=%d; setting it to 0 (https://issues.redhat.com/browse/JGRP-2806)", local_addr, port_range); + port_range=0; // https://issues.redhat.com/browse/JGRP-2806 + } gossip_routers.clear(); gossip_routers.addAll(Util.parseCommaDelimitedHosts2(gossip_router_hosts, port_range)); if(gossip_routers.isEmpty()) diff --git a/src/org/jgroups/stack/RouterStub.java b/src/org/jgroups/stack/RouterStub.java index e52d218f78..3a9073ebee 100644 --- a/src/org/jgroups/stack/RouterStub.java +++ b/src/org/jgroups/stack/RouterStub.java @@ -16,7 +16,10 @@ import java.net.InetAddress; import java.net.InetSocketAddress; import java.util.*; -import java.util.concurrent.TimeUnit; + +import static java.lang.System.currentTimeMillis; +import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static org.jgroups.util.Util.printTime; /** @@ -132,7 +135,7 @@ public void connect(String group, Address addr, String logical_name, PhysicalAdd _doConnect(); } if(handle_heartbeats) - last_heartbeat=System.currentTimeMillis(); + last_heartbeat=currentTimeMillis(); try { writeRequest(new GossipData(GossipType.REGISTER, group, addr, logical_name, phys_addr)); } @@ -231,7 +234,7 @@ public void receive(Address sender, DataInput in, int length) { break; } if(handle_heartbeats) - last_heartbeat=System.currentTimeMillis(); + last_heartbeat=currentTimeMillis(); } catch(Exception ex) { log.error(Util.getMessage("FailedReadingData"), ex); } @@ -262,7 +265,7 @@ public String toString() { return String.format("RouterStub[local=%s, router_host=%s %s] - age: %s", client != null? client.localAddress() : "n/a", remote, isConnected()? "connected" : "disconnected", - Util.printTime(System.currentTimeMillis()-last_heartbeat, TimeUnit.MILLISECONDS)); + isConnected()? printTime(currentTimeMillis()-last_heartbeat, MILLISECONDS) : "n/a"); } /** Creates remote from remote_sa. If the latter is unresolved, tries to resolve it one more time (e.g. via DNS) */