You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ga...@apache.org on 2006/09/22 18:27:25 UTC

svn commit: r448984 - /webservices/axis/trunk/java/src/org/apache/axis/components/uuid/FastUUIDGen.java

Author: gawor
Date: Fri Sep 22 09:27:24 2006
New Revision: 448984

URL: http://svn.apache.org/viewvc?view=rev&rev=448984
Log:
fixed uuid synchronization problems

Modified:
    webservices/axis/trunk/java/src/org/apache/axis/components/uuid/FastUUIDGen.java

Modified: webservices/axis/trunk/java/src/org/apache/axis/components/uuid/FastUUIDGen.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/java/src/org/apache/axis/components/uuid/FastUUIDGen.java?view=diff&rev=448984&r1=448983&r2=448984
==============================================================================
--- webservices/axis/trunk/java/src/org/apache/axis/components/uuid/FastUUIDGen.java (original)
+++ webservices/axis/trunk/java/src/org/apache/axis/components/uuid/FastUUIDGen.java Fri Sep 22 09:27:24 2006
@@ -30,7 +30,7 @@
     private static String nodeStr;
     private static int clockSequence;
 
-    private long lastTime = 0;
+    private static long lastTime = 0;
 
     static {
         // problem: the node should be the IEEE 802 ethernet address, but can not
@@ -78,19 +78,22 @@
         timestamp += 0x01b21dd2L << 32;
         timestamp += 0x13814000;
         
-        synchronized(this) {
-            if (time - lastTime <= 0) {
+        long localClockSequence;
+
+        synchronized(FastUUIDGen.class) {
+            if (time <= lastTime) {
                 clockSequence = ((clockSequence + 1) & 16383);
             }
             lastTime = time;
+            localClockSequence = clockSequence;
         }
 
         long timeLow = getBitsValue(timestamp, 32, 32);
         long timeMid = getBitsValue(timestamp, 48, 16);
         long timeHi = getBitsValue(timestamp, 64, 16) | 0x1000;
 
-        long clockSeqLow = getBitsValue(clockSequence, 8, 8);
-        long clockSeqHi = getBitsValue(clockSequence, 16, 8) | 0x80;
+        long clockSeqLow = getBitsValue(localClockSequence, 8, 8);
+        long clockSeqHi = getBitsValue(localClockSequence, 16, 8) | 0x80;
         
         String timeLowStr = leftZeroPadString(Long.toHexString(timeLow), 8);
         String timeMidStr = leftZeroPadString(Long.toHexString(timeMid), 4);



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org