jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cko...@apache.org
Subject svn commit: r1461524 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/MultiDataStore.java
Date Wed, 27 Mar 2013 11:19:17 GMT
Author: ckoell
Date: Wed Mar 27 11:19:17 2013
New Revision: 1461524

URL: http://svn.apache.org/r1461524
Log:
JCR-3512 DelayedDelete in MultiDatastore does not work correctly

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

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/MultiDataStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/MultiDataStore.java?rev=1461524&r1=1461523&r2=1461524&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/MultiDataStore.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/MultiDataStore.java
Wed Mar 27 11:19:17 2013
@@ -313,6 +313,9 @@ public class MultiDataStore implements D
         return archiveDataStore.getAllIdentifiers();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void init(String homeDir) throws RepositoryException {
         if (delayedDelete) {
             // First initialize the identifiersToDeleteFile
@@ -337,7 +340,8 @@ public class MultiDataStore implements D
                         && (identifiersToDeleteFile.lastModified() + (delayedDeleteSleep
* 1000)) < System
                                 .currentTimeMillis()) {
                     deleteDelayedIdentifiersTaskThread = new Thread(
-                            new DeleteDelayedIdentifiersTask(),
+                            //Start immediately ...
+                            new DeleteDelayedIdentifiersTask(0L),
                             "Jackrabbit-MultiDataStore-DeleteDelayedIdentifiersTaskThread");
                     deleteDelayedIdentifiersTaskThread.setDaemon(true);
                     deleteDelayedIdentifiersTaskThread.start();
@@ -361,6 +365,9 @@ public class MultiDataStore implements D
         return primaryDataStore.getMinRecordLength();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void close() throws DataStoreException {
         DataStoreException lastException = null;
         // 1. close the primary data store
@@ -403,6 +410,9 @@ public class MultiDataStore implements D
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void clearInUse() {
         archiveDataStore.clearInUse();
     }
@@ -539,7 +549,7 @@ public class MultiDataStore implements D
                             log.warn("The DeleteDelayedIdentifiersTask-Thread is already
running.");
                         } else {
                             deleteDelayedIdentifiersTaskThread = new Thread(
-                                    new DeleteDelayedIdentifiersTask(),
+                                    new DeleteDelayedIdentifiersTask(delayedDeleteSleep),
                                     "Jackrabbit-MultiDataStore-DeleteDelayedIdentifiersTaskThread");
                             deleteDelayedIdentifiersTaskThread.setDaemon(true);
                             deleteDelayedIdentifiersTaskThread.start();
@@ -615,6 +625,15 @@ public class MultiDataStore implements D
     public class DeleteDelayedIdentifiersTask implements Runnable {
 
         boolean run = true;
+        private long sleepTime = 0L;
+        
+        /**
+         * Constructor
+         * @param sleep how long this DeleteDelayedIdentifiersTask should sleep in seconds.
+         */
+        public DeleteDelayedIdentifiersTask(long sleep) {
+            this.sleepTime = (sleep * 1000L);
+        }
 
         @Override
         public void run() {
@@ -623,6 +642,14 @@ public class MultiDataStore implements D
                 return;
             }
             while (run && !Thread.currentThread().isInterrupted()) {
+                if (sleepTime > 0) {
+                    try {
+                        Thread.sleep(sleepTime);
+                    } catch (InterruptedException e) {
+                        Thread.currentThread().interrupt();
+                    }
+                }
+                log.info("Start to delete DataRecords from the primary data store.");
                 BufferedReader reader = null;
                 ArrayList<DataIdentifier> problemIdentifiers = new ArrayList<DataIdentifier>();
                 try {



Mime
View raw message