activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1209162 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IdGenerator.java
Date Thu, 01 Dec 2011 17:25:47 GMT
Author: gtully
Date: Thu Dec  1 17:25:46 2011
New Revision: 1209162

URL: http://svn.apache.org/viewvc?rev=1209162&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3614 - Unable to generate unique id when range of
ports are blocked - org.apache.activemq.util.IdGenerator. Patch applied with thanks, left
the log at warn as unique ids are important and two simultaneous clients could use the same
id with this fallback

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IdGenerator.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IdGenerator.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IdGenerator.java?rev=1209162&r1=1209161&r2=1209162&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IdGenerator.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IdGenerator.java Thu
Dec  1 17:25:46 2011
@@ -56,10 +56,14 @@ public class IdGenerator {
                 Thread.sleep(100);
                 ss.close();
             } catch (Exception ioe) {
-                LOG.warn("could not generate unique stub", ioe);
+                LOG.warn("could not generate unique stub by using DNS and binding to local
port", ioe);
             }
-        } else {
+        }
+        // fallback
+        if (hostName == null) {
             hostName = "localhost";
+        }
+        if (stub.length() == 0) {
             stub = "-1-" + System.currentTimeMillis() + "-";
         }
         UNIQUE_STUB = stub;



Mime
View raw message