jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1186757 - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/stats/RepositoryStatisticsImpl.java test/java/org/apache/jackrabbit/core/persistence/PersistenceManagerTest.java
Date Thu, 20 Oct 2011 12:17:27 GMT
Author: jukka
Date: Thu Oct 20 12:17:27 2011
New Revision: 1186757

URL: http://svn.apache.org/viewvc?rev=1186757&view=rev
Log:
JCR-3040: JMX Stats for the Session

Add an empty RepositoryStatisticsImpl constructor to simplify test cases

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/stats/RepositoryStatisticsImpl.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/persistence/PersistenceManagerTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/stats/RepositoryStatisticsImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/stats/RepositoryStatisticsImpl.java?rev=1186757&r1=1186756&r2=1186757&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/stats/RepositoryStatisticsImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/stats/RepositoryStatisticsImpl.java
Thu Oct 20 12:17:27 2011
@@ -35,13 +35,7 @@ public class RepositoryStatisticsImpl im
     private final Map<Type, TimeSeriesRecorder> recorders =
             new HashMap<Type, TimeSeriesRecorder>();
 
-    public RepositoryStatisticsImpl(ScheduledExecutorService executor) {
-        executor.scheduleAtFixedRate(new Runnable() {
-            public void run() {
-                recordOneSecond();
-            }
-        }, 1, 1, TimeUnit.SECONDS);
-        
+    public RepositoryStatisticsImpl() {
         getOrCreateRecorder(Type.SESSION_COUNT);
         getOrCreateRecorder(Type.SESSION_LOGIN_COUNTER);
         getOrCreateRecorder(Type.SESSION_READ_COUNTER);
@@ -54,6 +48,15 @@ public class RepositoryStatisticsImpl im
         getOrCreateRecorder(Type.BUNDLE_WRITE_DURATION);
     }
 
+    public RepositoryStatisticsImpl(ScheduledExecutorService executor) {
+        this();
+        executor.scheduleAtFixedRate(new Runnable() {
+            public void run() {
+                recordOneSecond();
+            }
+        }, 1, 1, TimeUnit.SECONDS);
+    }
+
     public synchronized Iterator<Entry<Type, TimeSeries>> iterator() {
         Map<Type, TimeSeries> map = new TreeMap<Type, TimeSeries>();
         map.putAll(recorders);

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/persistence/PersistenceManagerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/persistence/PersistenceManagerTest.java?rev=1186757&r1=1186756&r2=1186757&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/persistence/PersistenceManagerTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/persistence/PersistenceManagerTest.java
Thu Oct 20 12:17:27 2011
@@ -119,7 +119,6 @@ public class PersistenceManagerTest exte
 
     private void assertPersistenceManager(PersistenceManager manager)
             throws Exception {
-        ScheduledExecutorService pool = Executors.newScheduledThreadPool(1);
         manager.init(new PMContext(
                 directory,
                 new MemoryFileSystem(),
@@ -127,7 +126,7 @@ public class PersistenceManagerTest exte
                 new NamespaceRegistryImpl(new MemoryFileSystem()),
                 null,
                 null,
-                new RepositoryStatisticsImpl(pool)));
+                new RepositoryStatisticsImpl()));
         try {
             assertCreateNewNode(manager);
             assertCreateNewProperty(manager);
@@ -135,7 +134,6 @@ public class PersistenceManagerTest exte
             assertCreateUpdateDelete(manager);
         } finally {
             manager.close();
-            pool.shutdown();
         }
     }
 



Mime
View raw message