Author: davsclaus Date: Thu Dec 8 10:39:49 2011 New Revision: 1211811 URL: http://svn.apache.org/viewvc?rev=1211811&view=rev Log: CAMEL-4752: Updated the AMQ uid generator with code changes in AMQ source.
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ActiveMQUuidGenerator.java Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ActiveMQUuidGenerator.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ActiveMQUuidGenerator.java?rev=1211811&r1=1211810&r2=1211811&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ActiveMQUuidGenerator.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ActiveMQUuidGenerator.java Thu Dec 8 10:39:49 2011 @@ -21,6 +21,7 @@ import java.util.concurrent.atomic.Atomi import org.apache.camel.spi.UuidGenerator; import org.apache.camel.util.InetAddressUtil; +import org.apache.camel.util.ObjectHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -61,10 +62,16 @@ public class ActiveMQUuidGenerator imple Thread.sleep(100); ss.close(); } catch (Exception ioe) { - LOG.warn("Cannot generate unique stub", ioe); + LOG.warn("Could not generate unique stub by using DNS and binding to local port, will fallback and use localhost as name", ioe); } - } else { + } + + // fallback to use localhost + if (hostName == null) { hostName = "localhost"; + } + + if (ObjectHelper.isEmpty(stub)) { stub = "-1-" + System.currentTimeMillis() + "-"; } UNIQUE_STUB = stub;