jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r921373 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/FileDataStore.java
Date Wed, 10 Mar 2010 14:46:50 GMT
Author: thomasm
Date: Wed Mar 10 14:46:50 2010
New Revision: 921373

URL: http://svn.apache.org/viewvc?rev=921373&view=rev
Log:
JCR-2556 Data store garbage collection: log deleted files and total size

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

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/FileDataStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/FileDataStore.java?rev=921373&r1=921372&r2=921373&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/FileDataStore.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/FileDataStore.java
Wed Mar 10 14:46:50 2010
@@ -25,6 +25,7 @@ import java.lang.ref.WeakReference;
 import java.security.DigestOutputStream;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
+import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
@@ -33,6 +34,8 @@ import java.util.Map;
 import java.util.WeakHashMap;
 
 import org.apache.commons.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Simple file-based data store. Data records are stored as normal files
@@ -58,6 +61,11 @@ import org.apache.commons.io.IOUtils;
 public class FileDataStore implements DataStore {
 
     /**
+     * Logger instance
+     */
+    private static Logger log = LoggerFactory.getLogger(FileDataStore.class);
+
+    /**
      * The digest algorithm used to uniquely identify records.
      */
     private static final String DIGEST = "SHA-1";
@@ -303,6 +311,11 @@ public class FileDataStore implements Da
                 if (file.lastModified() < min) {
                     DataIdentifier id = new DataIdentifier(fileName);
                     if (!inUse.containsKey(id)) {
+                        if (log.isInfoEnabled()) {
+                            log.info("Deleting old file " + file.getAbsolutePath() +
+                                    " modified: " + new Timestamp(file.lastModified()).toString()
+
+                                    " length: " + file.length());
+                        }
                         file.delete();
                         count++;
                     }



Mime
View raw message