Author: tomekr
Date: Fri Oct 28 09:44:12 2016
New Revision: 1766992

URL: http://svn.apache.org/viewvc?rev=1766992&view=rev
Log:
OAK-4882: Bottleneck in the asynchronous persistent cache

Close the persistent cache after each test.

Modified:
    
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/persistentCache/AsyncQueueTest.java

Modified: 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/persistentCache/AsyncQueueTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/persistentCache/AsyncQueueTest.java?rev=1766992&r1=1766991&r2=1766992&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/persistentCache/AsyncQueueTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/persistentCache/AsyncQueueTest.java
 Fri Oct 28 09:44:12 2016
@@ -26,6 +26,7 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.plugins.document.RevisionVector;
 import 
org.apache.jackrabbit.oak.plugins.document.persistentCache.async.CacheWriteQueue;
 import org.apache.jackrabbit.oak.plugins.document.util.StringValue;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -45,6 +46,8 @@ public class AsyncQueueTest {
 
     private static final StringValue VAL = new StringValue("xyz");
 
+    private PersistentCache pCache;
+
     private List<PathRev> putActions;
 
     private List<PathRev> invalidateActions;
@@ -56,7 +59,7 @@ public class AsyncQueueTest {
     @Before
     public void setup() throws IOException {
         FileUtils.deleteDirectory(new File("target/cacheTest"));
-        PersistentCache pCache = new 
PersistentCache("target/cacheTest,+async");
+        pCache = new PersistentCache("target/cacheTest,+async");
         final AtomicReference<NodeCache<PathRev, StringValue>> nodeCacheRef = 
new AtomicReference<NodeCache<PathRev, StringValue>>();
         CacheLIRS<PathRev, StringValue> cache = new CacheLIRS.Builder<PathRev, 
StringValue>().maximumSize(1).evictionCallback(new 
CacheLIRS.EvictionCallback<PathRev, StringValue>() {
             @Override
@@ -77,6 +80,13 @@ public class AsyncQueueTest {
         this.id = 0;
     }
 
+    @After
+    public void teardown() {
+        if (pCache != null) {
+            pCache.close();
+        }
+    }
+    
     @Test
     public void unusedItemsShouldntBePersisted() {
         PathRev k = generatePathRev();


Reply via email to