jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1565133 - /jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ObservationTest.java
Date Thu, 06 Feb 2014 09:32:58 GMT
Author: mreutegg
Date: Thu Feb  6 09:32:57 2014
New Revision: 1565133

URL: http://svn.apache.org/r1565133
Log:
OAK-1394: Event generation too slow with DocumentNodeStore

More realistic test scenario: use one session per listener

Modified:
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ObservationTest.java

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ObservationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ObservationTest.java?rev=1565133&r1=1565132&r2=1565133&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ObservationTest.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ObservationTest.java
Thu Feb  6 09:32:57 2014
@@ -72,28 +72,31 @@ public class ObservationTest extends Ben
     }
 
     private void run(Repository repository) throws RepositoryException, ExecutionException,
InterruptedException {
-        Session session = repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
+        Session session = createSession(repository);
         long t0 = System.currentTimeMillis();
         try {
-            observationThroughput(repository, session.getWorkspace().getObservationManager());
+            observationThroughput(repository);
         } finally {
             System.out.println("Time elapsed: " + (System.currentTimeMillis() - t0) + " ms");
             session.logout();
         }
     }
 
-    public void observationThroughput(final Repository repository, ObservationManager observationManager)
+    public void observationThroughput(final Repository repository)
             throws RepositoryException, InterruptedException, ExecutionException {
         long t = 0;
         final AtomicInteger eventCount = new AtomicInteger();
         final AtomicInteger nodeCount = new AtomicInteger();
 
+        Session[] sessions = new Session[LISTENER_COUNT];
         EventListener[] listeners = new Listener[LISTENER_COUNT];
 
         try {
             for (int k = 0; k < LISTENER_COUNT; k++) {
+                sessions[k] = createSession(repository);
                 listeners[k] = new Listener(eventCount);
-                observationManager.addEventListener(listeners[k], EVENT_TYPES, "/", true,
null, null, false);
+                ObservationManager obsMgr = sessions[k].getWorkspace().getObservationManager();
+                obsMgr.addEventListener(listeners[k], EVENT_TYPES, "/", true, null, null,
false);
             }
 
             Future<?> createNodes = Executors.newSingleThreadExecutor().submit(new
Runnable() {
@@ -146,11 +149,17 @@ public class ObservationTest extends Ben
             createNodes.get();
         } finally {
             for (int k = 0; k < LISTENER_COUNT; k++) {
-                observationManager.removeEventListener(listeners[k]);
+                sessions[k].getWorkspace().getObservationManager().removeEventListener(listeners[k]);
+                sessions[k].logout();
             }
         }
     }
 
+    private static Session createSession(Repository repository)
+            throws RepositoryException {
+        return repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
+    }
+
     private static class Listener implements EventListener {
         private final AtomicInteger eventCount;
 



Mime
View raw message