directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r785765 - /directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/csn/CsnFactory.java
Date Wed, 17 Jun 2009 19:32:50 GMT
Author: elecharny
Date: Wed Jun 17 19:32:48 2009
New Revision: 785765

URL: http://svn.apache.org/viewvc?rev=785765&view=rev
Log:
Fixed a problem in the CSN factory : we may have had produced incorrect incremental CSN

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/csn/CsnFactory.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/csn/CsnFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/csn/CsnFactory.java?rev=785765&r1=785764&r2=785765&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/csn/CsnFactory.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/csn/CsnFactory.java
Wed Jun 17 19:32:48 2009
@@ -56,17 +56,20 @@
      */
     public Csn newInstance()
     {
-        long newTimestamp = System.currentTimeMillis();
-        
-        // We will be able to generate 2 147 483 647 CSNs each 10 ms max
-        if ( lastTimestamp == newTimestamp )
+        synchronized ( changeCount )
         {
-            changeCount.incrementAndGet();
-        }
-        else
-        {
-            lastTimestamp = newTimestamp;
-            changeCount.set( 0 );
+            long newTimestamp = System.currentTimeMillis();
+            
+            // We will be able to generate 2 147 483 647 CSNs each 10 ms max
+            if ( lastTimestamp == newTimestamp )
+            {
+                changeCount.incrementAndGet();
+            }
+            else
+            {
+                lastTimestamp = newTimestamp;
+                changeCount.set( 0 );
+            }
         }
 
         return new Csn( lastTimestamp, changeCount.get(), replicaId, 0 );



Mime
View raw message