jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1582686 - /jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/FileDataStore.java
Date Fri, 28 Mar 2014 10:45:31 GMT
Author: thomasm
Date: Fri Mar 28 10:45:31 2014
New Revision: 1582686

URL: http://svn.apache.org/r1582686
Log:
JCR-3760 FileDataStore: reduce synchronization

Modified:
    jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/FileDataStore.java

Modified: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/FileDataStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/FileDataStore.java?rev=1582686&r1=1582685&r2=1582686&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/FileDataStore.java
(original)
+++ jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/FileDataStore.java
Fri Mar 28 10:45:31 2014
@@ -93,7 +93,7 @@ public class FileDataStore extends Abstr
      * The minimum modified date. If a file is accessed (read or write) with a modified date
      * older than this value, the modified date is updated to the current time.
      */
-    private long minModifiedDate;
+    private volatile long minModifiedDate;
 
     /**
      * The directory that contains all the data record files. The structure
@@ -141,19 +141,19 @@ public class FileDataStore extends Abstr
      */
     public DataRecord getRecordIfStored(DataIdentifier identifier) throws DataStoreException
{
         File file = getFile(identifier);
-        synchronized (this) {
-            if (!file.exists()) {
-                return null;
-            }
-            if (minModifiedDate != 0) {
-                // only check when running garbage collection
+        if (!file.exists()) {
+            return null;
+        }
+        if (minModifiedDate != 0) {
+            // only check when running garbage collection
+            synchronized (this) {
                 if (getLastModified(file) < minModifiedDate) {
                     setLastModified(file, System.currentTimeMillis() + ACCESS_TIME_RESOLUTION);
                 }
             }
-            usesIdentifier(identifier);
-            return new FileDataRecord(this, identifier, file);
         }
+        usesIdentifier(identifier);
+        return new FileDataRecord(this, identifier, file);
     }
 
     private void usesIdentifier(DataIdentifier identifier) {



Mime
View raw message