You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by mr...@apache.org on 2015/08/12 14:52:05 UTC

svn commit: r1695498 - /jackrabbit/oak/branches/1.0/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalTest.java

Author: mreutegg
Date: Wed Aug 12 12:52:05 2015
New Revision: 1695498

URL: http://svn.apache.org/r1695498
Log:
OAK-3221: JournalTest may fail on machine with slow I/O

Use in-memory map for test with high concurrency

Modified:
    jackrabbit/oak/branches/1.0/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalTest.java

Modified: jackrabbit/oak/branches/1.0/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalTest.java?rev=1695498&r1=1695497&r2=1695498&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.0/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalTest.java (original)
+++ jackrabbit/oak/branches/1.0/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalTest.java Wed Aug 12 12:52:05 2015
@@ -398,28 +398,35 @@ public class JournalTest extends Abstrac
             final CountDownLatch start = new CountDownLatch(1);
             final CountDownLatch end = new CountDownLatch(NUM_THREADS);
             final List<Exception> exceptions = synchronizedList(new ArrayList<Exception>());
-            for (int i = 0; i < NUM_THREADS; i++) {
-                Thread th = new Thread(new Runnable() {
-    
-                    @Override
-                    public void run() {
-                        try {
-                            ready.countDown();
-                            start.await();
-                            recovery.recover(Iterators.forArray(x1,z1), c2Id);
-                        } catch (Exception e) {
-                            exceptions.add(e);
-                        } finally {
-                            end.countDown();
+            // use memory map factory to speed up test with
+            // many concurrent threads
+            System.setProperty("oak.useMemoryMapFactory", "true");
+            try {
+                for (int i = 0; i < NUM_THREADS; i++) {
+                    Thread th = new Thread(new Runnable() {
+
+                        @Override
+                        public void run() {
+                            try {
+                                ready.countDown();
+                                start.await();
+                                recovery.recover(Iterators.forArray(x1,z1), c2Id);
+                            } catch (Exception e) {
+                                exceptions.add(e);
+                            } finally {
+                                end.countDown();
+                            }
                         }
-                    }
-                    
-                });
-                th.start();
+
+                    });
+                    th.start();
+                }
+                ready.await(5, TimeUnit.SECONDS);
+                start.countDown();
+                assertTrue(end.await(20, TimeUnit.SECONDS));
+            } finally {
+                System.clearProperty("oak.useMemoryMapFactory");
             }
-            ready.await(5, TimeUnit.SECONDS);
-            start.countDown();
-            assertTrue(end.await(20, TimeUnit.SECONDS));
             assertJournalEntries(ds1, "{}", change1); // unchanged
             assertJournalEntries(ds2, "{}", change2, change2b);
             for (Exception ex : exceptions) {