You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2008/05/28 09:17:46 UTC
svn commit: r660841 -
/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UuidGenerator.java
Author: ningjiang
Date: Wed May 28 00:17:46 2008
New Revision: 660841
URL: http://svn.apache.org/viewvc?rev=660841&view=rev
Log:
Revert the change of UuidGenerator
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UuidGenerator.java
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UuidGenerator.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UuidGenerator.java?rev=660841&r1=660840&r2=660841&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UuidGenerator.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UuidGenerator.java Wed May 28 00:17:46 2008
@@ -28,30 +28,14 @@
*/
public class UuidGenerator {
- private static final transient Log LOG = LogFactory.getLog(UuidGenerator.class);
- private static String UNIQUE_STUB;
+ private static final transient Log LOG = LogFactory.getLog(UuidGenerator.class);
+ private static final String UNIQUE_STUB;
private static int instanceCount;
private static String hostName;
private String seed;
private long sequence;
- public UuidGenerator(String prefix) {
- synchronized (UNIQUE_STUB) {
- if (UNIQUE_STUB == null) {
- init();
- }
- this.seed = prefix + UNIQUE_STUB + (instanceCount++) + "-";
- }
- }
-
- public UuidGenerator() {
- this("ID-" + hostName);
- }
-
- /**
- * Initializes the stub - not static codeblock to let commons-logging work
- */
- private void init() {
+ static {
String stub = "";
boolean canAccessSystemProps = true;
try {
@@ -77,14 +61,19 @@
hostName = "localhost";
stub = "-1-" + System.currentTimeMillis() + "-";
}
-
UNIQUE_STUB = stub;
+ }
- if (LOG.isDebugEnabled()) {
- LOG.debug("UuidGenerator initialized with stub genereated: " + UNIQUE_STUB);
+ public UuidGenerator(String prefix) {
+ synchronized (UNIQUE_STUB) {
+ this.seed = prefix + UNIQUE_STUB + (instanceCount++) + "-";
}
}
+ public UuidGenerator() {
+ this("ID-" + hostName);
+ }
+
/**
* As we have to find the hostname as a side-affect of generating a unique
* stub, we allow it's easy retrevial here