jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1334949 - in /jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk: core/Repository.java store/DefaultRevisionStore.java
Date Mon, 07 May 2012 10:20:38 GMT
Author: jukka
Date: Mon May  7 10:20:38 2012
New Revision: 1334949

URL: http://svn.apache.org/viewvc?rev=1334949&view=rev
Log:
OAK-82: Running MicroKernelIT test with the InMem persistence creates a lot of GC threads

Disable the MK garbage collector when constructing an in-memory test instance

Modified:
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/Repository.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/store/DefaultRevisionStore.java

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/Repository.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/Repository.java?rev=1334949&r1=1334948&r2=1334949&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/Repository.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/Repository.java
Mon May  7 10:20:38 2012
@@ -69,9 +69,10 @@ public class Repository {
      */
     protected Repository() {
         this.homeDir = null;
-        
-        DefaultRevisionStore rs = new DefaultRevisionStore(new InMemPersistence());
-        
+
+        DefaultRevisionStore rs =
+                new DefaultRevisionStore(new InMemPersistence(), null);
+
         try {
             rs.initialize();
         } catch (Exception e) {

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/store/DefaultRevisionStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/store/DefaultRevisionStore.java?rev=1334949&r1=1334948&r2=1334949&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/store/DefaultRevisionStore.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/store/DefaultRevisionStore.java
Mon May  7 10:20:38 2012
@@ -59,7 +59,9 @@ public class DefaultRevisionStore extend
 
     private boolean initialized;
     private Id head;
-    private AtomicLong commitCounter;
+
+    private final AtomicLong commitCounter = new AtomicLong();
+
     private final ReentrantReadWriteLock headLock = new ReentrantReadWriteLock();
     private final Persistence pm;
     protected final GCPersistence gcpm;
@@ -99,12 +101,21 @@ public class DefaultRevisionStore extend
      * Active branches (Key: branch root id, Value: branch head).
      */
     private final Map<Id,Id> branches = Collections.synchronizedMap(new TreeMap<Id,
Id>());
-    
+
     public DefaultRevisionStore(Persistence pm) {
-        this.pm = pm;
-        this.gcpm = (pm instanceof GCPersistence) ? (GCPersistence) pm : null;
+        this(pm, (pm instanceof GCPersistence) ? (GCPersistence) pm : null);
+    }
 
-        commitCounter = new AtomicLong();
+    /**
+     * Alternative constructor that allows disabling of garbage collection
+     * for an in-memory test repository.
+     *
+     * @param pm persistence manager
+     * @param gcpm the same persistence manager, or {@code null} for no GC
+     */
+    public DefaultRevisionStore(Persistence pm, GCPersistence gcpm) {
+        this.pm = pm;
+        this.gcpm = gcpm;
     }
 
     public void initialize() throws Exception {



Mime
View raw message