jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r1205778 - in /jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store: PersistenceManager.java PersistentId.java
Date Thu, 24 Nov 2011 10:26:20 GMT
Author: stefan
Date: Thu Nov 24 10:26:19 2011
New Revision: 1205778

URL: http://svn.apache.org/viewvc?rev=1205778&view=rev
Log:
misc. minor changes

Modified:
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/PersistenceManager.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/PersistentId.java

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/PersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/PersistenceManager.java?rev=1205778&r1=1205777&r2=1205778&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/PersistenceManager.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/PersistenceManager.java
Thu Nov 24 10:26:19 2011
@@ -29,6 +29,9 @@ import java.util.concurrent.locks.Reentr
  */
 public class PersistenceManager {
 
+    public static final String CACHE_SIZE = "microKernel.cacheSize";
+    public static final int DEFAULT_CACHE_SIZE = 10000;
+
     boolean initialized;
     ReentrantLock headLock = new ReentrantLock();
     RevisionStore revStore;
@@ -44,7 +47,10 @@ public class PersistenceManager {
         revStore = revs;
         blobStore = blobs;
 
-        cache = Collections.synchronizedMap(SimpleLRUCache.<String, Object>newInstance(10000));
+        String val = System.getProperty(CACHE_SIZE);
+        int cacheSize = (val != null) ? Integer.parseInt(val) : DEFAULT_CACHE_SIZE;
+
+        cache = Collections.synchronizedMap(SimpleLRUCache.<String, Object>newInstance(cacheSize));
 
         // make sure we've got a HEAD commit
         String head = revStore.getHeadId();

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/PersistentId.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/PersistentId.java?rev=1205778&r1=1205777&r2=1205778&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/PersistentId.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/PersistentId.java
Thu Nov 24 10:26:19 2011
@@ -53,7 +53,7 @@ public class PersistentId {
         rwLock.readLock().lock();
         try {
             if (id == null) {
-                DataInputStream in = new DataInputStream(new FileInputStream(file));
+                FileInputStream in = new FileInputStream(file);
                 id = IOUtils.readString(in);
                 in.close();
             }
@@ -66,7 +66,7 @@ public class PersistentId {
     public void set(String id) throws IOException {
         rwLock.writeLock().lock();
         try {
-            DataOutputStream out = new DataOutputStream(new FileOutputStream(file));
+            FileOutputStream out = new FileOutputStream(file);
             IOUtils.writeString(out, id);
             out.close();
             this.id = id;



Mime
View raw message