jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1496457 - in /jackrabbit/oak/trunk: oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ oak-jcr/src/test/java/org/apache...
Date Tue, 25 Jun 2013 13:03:38 GMT
Author: mduerig
Date: Tue Jun 25 13:03:37 2013
New Revision: 1496457

URL: http://svn.apache.org/r1496457
Log:
OAK-879: Default ScheduledExecutorService improvements
use default value for ScheduledExecutorService from Oak

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStubBase.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakMongoMKRepositoryStub.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakSegmentMKRepositoryStub.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeRegistrationTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/AbstractImportTest.java
    jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/query/MultiSessionQueryTest.java
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStubBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStubBase.java?rev=1496457&r1=1496456&r2=1496457&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStubBase.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStubBase.java
Tue Jun 25 13:03:37 2013
@@ -19,7 +19,7 @@ package org.apache.jackrabbit.oak.jcr;
 import java.security.Principal;
 import java.util.Iterator;
 import java.util.Properties;
-import java.util.concurrent.Executors;
+
 import javax.jcr.Credentials;
 import javax.jcr.GuestCredentials;
 import javax.jcr.Repository;
@@ -47,7 +47,6 @@ public class OakRepositoryStubBase exten
 
         String dir = "target/mk-tck-" + System.currentTimeMillis();
         Jcr jcr = new Jcr(new MicroKernelImpl(dir));
-        jcr.with(Executors.newScheduledThreadPool(1));
         preCreateRepository(jcr);
         repository = jcr.createRepository();
     }

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java?rev=1496457&r1=1496456&r2=1496457&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java
Tue Jun 25 13:03:37 2013
@@ -16,8 +16,6 @@
  */
 package org.apache.jackrabbit.oak.jcr;
 
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
@@ -34,8 +32,6 @@ import org.junit.After;
  */
 public abstract class AbstractRepositoryTest {
 
-    protected ScheduledExecutorService executor = null;
-
     private Repository repository = null;
     private Session adminSession = null;
 
@@ -48,24 +44,15 @@ public abstract class AbstractRepository
         }
         // release repository field
         repository = null;
-
-        if (executor != null) {
-            executor.shutdown();
-            executor = null;
-        }
     }
 
     protected Repository getRepository() throws RepositoryException {
         if (repository == null) {
-            repository  = new Jcr().with(getExecutor()).createRepository();
+            repository  = new Jcr().createRepository();
         }
         return repository;
     }
 
-    private ScheduledExecutorService getExecutor() {
-        return (executor == null) ? Executors.newScheduledThreadPool(0) : executor;
-    }
-
     protected Session getAdminSession() throws RepositoryException {
         if (adminSession == null) {
             adminSession = createAdminSession();

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakMongoMKRepositoryStub.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakMongoMKRepositoryStub.java?rev=1496457&r1=1496456&r2=1496457&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakMongoMKRepositoryStub.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakMongoMKRepositoryStub.java
Tue Jun 25 13:03:37 2013
@@ -19,7 +19,6 @@ package org.apache.jackrabbit.oak.jcr;
 import java.lang.ref.WeakReference;
 import java.security.Principal;
 import java.util.Properties;
-import java.util.concurrent.Executors;
 
 import javax.jcr.Credentials;
 import javax.jcr.GuestCredentials;
@@ -28,14 +27,13 @@ import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.UnsupportedRepositoryOperationException;
 
+import com.mongodb.BasicDBObject;
 import org.apache.jackrabbit.api.JackrabbitSession;
 import org.apache.jackrabbit.oak.plugins.mongomk.MongoMK;
 import org.apache.jackrabbit.oak.plugins.mongomk.util.MongoConnection;
 import org.apache.jackrabbit.test.NotExecutableException;
 import org.apache.jackrabbit.test.RepositoryStub;
 
-import com.mongodb.BasicDBObject;
-
 /**
  * A repository stub implementation for Oak on MongoMK
  */
@@ -75,7 +73,6 @@ public class OakMongoMKRepositoryStub ex
             MongoMK m = new MongoMK.Builder().setClusterId(1).
                     setMongoDB(connection.getDB()).open();
             Jcr jcr = new Jcr(m);
-            jcr.with(Executors.newScheduledThreadPool(1));
             this.repository = jcr.createRepository();
 
             session = getRepository().login(superuser);

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakSegmentMKRepositoryStub.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakSegmentMKRepositoryStub.java?rev=1496457&r1=1496456&r2=1496457&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakSegmentMKRepositoryStub.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakSegmentMKRepositoryStub.java
Tue Jun 25 13:03:37 2013
@@ -18,7 +18,6 @@ package org.apache.jackrabbit.oak.jcr;
 
 import java.security.Principal;
 import java.util.Properties;
-import java.util.concurrent.Executors;
 
 import javax.jcr.Credentials;
 import javax.jcr.GuestCredentials;
@@ -27,6 +26,7 @@ import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.UnsupportedRepositoryOperationException;
 
+import com.mongodb.Mongo;
 import org.apache.jackrabbit.api.JackrabbitSession;
 import org.apache.jackrabbit.api.security.principal.PrincipalIterator;
 import org.apache.jackrabbit.api.security.principal.PrincipalManager;
@@ -36,8 +36,6 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.test.NotExecutableException;
 import org.apache.jackrabbit.test.RepositoryStub;
 
-import com.mongodb.Mongo;
-
 /**
  * A repository stub implementation for Oak on MongoMK
  */
@@ -70,7 +68,6 @@ public class OakSegmentMKRepositoryStub 
             this.connection = new Mongo(HOST, PORT);
             Jcr jcr = new Jcr(new Oak(new SegmentNodeStore(
                     new MongoStore(connection.getDB(DB), 100 * 1024 * 1024))));
-            jcr.with(Executors.newScheduledThreadPool(1));
             this.repository = jcr.createRepository();
 
             session = getRepository().login(superuser);

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java?rev=1496457&r1=1496456&r2=1496457&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
Tue Jun 25 13:03:37 2013
@@ -75,8 +75,6 @@ public class RepositoryTest extends Abst
 
     @Before
     public void setup() throws RepositoryException {
-        executor = Executors.newScheduledThreadPool(1);
-
         Session session = getAdminSession();
         ValueFactory valueFactory = session.getValueFactory();
         Node root = session.getRootNode();

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationTest.java?rev=1496457&r1=1496456&r2=1496457&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationTest.java
Tue Jun 25 13:03:37 2013
@@ -71,7 +71,6 @@ public class ObservationTest extends Abs
 
     @Before
     public void setup() throws RepositoryException {
-        executor = Executors.newScheduledThreadPool(1);
         Session session = getAdminSession();
         session.getRootNode().addNode(TEST_NODE);
         session.save();

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeRegistrationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeRegistrationTest.java?rev=1496457&r1=1496456&r2=1496457&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeRegistrationTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeRegistrationTest.java
Tue Jun 25 13:03:37 2013
@@ -21,7 +21,7 @@ import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.Executors;
+
 import javax.jcr.AccessDeniedException;
 import javax.jcr.InvalidItemStateException;
 import javax.jcr.NamespaceException;
@@ -37,8 +37,8 @@ import org.apache.jackrabbit.api.securit
 import org.apache.jackrabbit.commons.jackrabbit.authorization.AccessControlUtils;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.jcr.Jcr;
-import org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConstants;
 import org.apache.jackrabbit.oak.spi.security.principal.EveryonePrincipal;
+import org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConstants;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -58,9 +58,7 @@ public class PrivilegeRegistrationTest e
 
         // create a separate repository in order to be able to remove registered privileges.
         String dir = "target/mk-tck-" + System.currentTimeMillis();
-        repository = new Jcr(new MicroKernelImpl(dir))
-            .with(Executors.newScheduledThreadPool(1))
-            .createRepository();
+        repository = new Jcr(new MicroKernelImpl(dir)).createRepository();
         session = getAdminSession();
         privilegeManager = getPrivilegeManager(session);
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/AbstractImportTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/AbstractImportTest.java?rev=1496457&r1=1496456&r2=1496457&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/AbstractImportTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/AbstractImportTest.java
Tue Jun 25 13:03:37 2013
@@ -21,7 +21,7 @@ import java.io.InputStream;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.concurrent.Executors;
+
 import javax.jcr.ImportUUIDBehavior;
 import javax.jcr.Node;
 import javax.jcr.Repository;
@@ -76,8 +76,7 @@ public abstract class AbstractImportTest
             SecurityProvider securityProvider = new SecurityProviderImpl(config);
             String dir = "target/mk-tck-" + System.currentTimeMillis();
             Jcr jcr = new Jcr(new MicroKernelImpl(dir));
-            jcr.with(Executors.newScheduledThreadPool(1))
-                    .with(securityProvider);
+            jcr.with(securityProvider);
             repo = jcr.createRepository();
             adminSession = repo.login(getHelper().getSuperuserCredentials());
         } else {

Modified: jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/query/MultiSessionQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/query/MultiSessionQueryTest.java?rev=1496457&r1=1496456&r2=1496457&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/query/MultiSessionQueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/query/MultiSessionQueryTest.java
Tue Jun 25 13:03:37 2013
@@ -16,9 +16,6 @@
  */
 package org.apache.jackrabbit.oak.jcr.query;
 
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-
 import javax.jcr.Node;
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
@@ -30,7 +27,6 @@ import org.apache.jackrabbit.oak.jcr.Jcr
 import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider;
 import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider;
 import org.apache.jackrabbit.oak.plugins.index.lucene.util.LuceneInitializerHelper;
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -43,16 +39,12 @@ public class MultiSessionQueryTest {
 
     final static int THREAD_COUNT = 3;
 
-    protected ScheduledExecutorService executor = null;
     private Repository repository = null;
 
     @Before
     public void before() {
-        executor = Executors.newScheduledThreadPool(1);
-
         String dir = "target/mk-tck-" + System.currentTimeMillis();
         Jcr jcr = new Jcr(new MicroKernelImpl(dir));
-        jcr.with(executor);
 
         // lucene specific
         jcr.with(new LuceneInitializerHelper("lucene").async());
@@ -62,13 +54,6 @@ public class MultiSessionQueryTest {
         repository = jcr.createRepository();
     }
 
-    @After
-    public void after() {
-        if (executor != null) {
-            executor.shutdown();
-        }
-    }
-
     protected Session createAdminSession() throws RepositoryException {
         return repository.login(new SimpleCredentials("admin", "admin"
                 .toCharArray()));

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java?rev=1496457&r1=1496456&r2=1496457&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java (original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java Tue
Jun 25 13:03:37 2013
@@ -18,8 +18,6 @@ package org.apache.jackrabbit.oak.run;
 
 import java.io.InputStream;
 import java.util.Properties;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
 
 import javax.jcr.Repository;
 
@@ -105,8 +103,6 @@ public class Main {
 
         private final MicroKernel[] kernels;
 
-        private final ScheduledExecutorService executor;
-
         public HttpServer(String uri, String[] args) throws Exception {
             int port = java.net.URI.create(uri).getPort();
             if (port == -1) {
@@ -117,8 +113,6 @@ public class Main {
             context = new ServletContextHandler();
             context.setContextPath("/");
 
-            executor = Executors.newScheduledThreadPool(3);
-
             if (args.length == 0) {
                 System.out.println("Starting an in-memory repository");
                 System.out.println(uri + " -> [memory]");
@@ -151,12 +145,11 @@ public class Main {
 
         public void stop() throws Exception {
             server.stop();
-            executor.shutdown();
         }
 
         private void addServlets(NodeStore store, String path) {
             Oak oak = new Oak(store);
-            Jcr jcr = new Jcr(oak).with(executor);
+            Jcr jcr = new Jcr(oak);
 
             ContentRepository repository = oak.createContentRepository();
 



Mime
View raw message