jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r898702 - in /jackrabbit/branches/2.0: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
Date Wed, 13 Jan 2010 10:23:31 GMT
Author: jukka
Date: Wed Jan 13 10:23:31 2010
New Revision: 898702

URL: http://svn.apache.org/viewvc?rev=898702&view=rev
Log:
2.0: Merged revision 898699 (JCR-2465)

Modified:
    jackrabbit/branches/2.0/   (props changed)
    jackrabbit/branches/2.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java

Propchange: jackrabbit/branches/2.0/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jan 13 10:23:31 2010
@@ -2,4 +2,4 @@
 /jackrabbit/sandbox/JCR-1456:774917-886178
 /jackrabbit/sandbox/JCR-2170:812417-816332
 /jackrabbit/sandbox/tripod-JCR-2209:795441-795863
-/jackrabbit/trunk:891595,891629,892253,892263,894150-894151,896408,896513,896532,896857,896870,896876,896908,896940,896942-896943,896969,896977,897071,897836,897842,897858,897935,898042,898677
+/jackrabbit/trunk:891595,891629,892253,892263,894150-894151,896408,896513,896532,896857,896870,896876,896908,896940,896942-896943,896969,896977,897071,897836,897842,897858,897935,898042,898677,898699

Modified: jackrabbit/branches/2.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java?rev=898702&r1=898701&r2=898702&view=diff
==============================================================================
--- jackrabbit/branches/2.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
(original)
+++ jackrabbit/branches/2.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
Wed Jan 13 10:23:31 2010
@@ -34,21 +34,23 @@
 import java.util.Set;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.jcr.AccessDeniedException;
 import javax.jcr.Credentials;
 import javax.jcr.LoginException;
 import javax.jcr.NamespaceRegistry;
 import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.PropertyType;
+import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.SimpleCredentials;
 import javax.jcr.Value;
 import javax.jcr.ValueFactory;
-import javax.jcr.Repository;
-import javax.jcr.PropertyType;
 import javax.jcr.observation.Event;
 import javax.jcr.observation.ObservationManager;
 import javax.security.auth.Subject;
@@ -104,10 +106,10 @@
 import org.apache.jackrabbit.core.version.InternalVersionManager;
 import org.apache.jackrabbit.core.version.InternalVersionManagerImpl;
 import org.apache.jackrabbit.core.xml.ClonedInputSource;
-import org.apache.jackrabbit.value.ValueFactoryImpl;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
 import org.apache.jackrabbit.spi.commons.namespace.RegistryNamespaceResolver;
+import org.apache.jackrabbit.value.ValueFactoryImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.InputSource;
@@ -267,8 +269,30 @@
      *                             or another error occurs.
      */
     protected RepositoryImpl(RepositoryConfig repConfig) throws RepositoryException {
+        // we should use the jackrabbit classloader for all background threads
+        // from the pool
+        final ClassLoader poolClassLoader = this.getClass().getClassLoader();
         ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(
                 Runtime.getRuntime().availableProcessors() * 2,
+                new ThreadFactory() {
+
+                    final AtomicInteger threadNumber = new AtomicInteger(1);
+
+                    /**
+                     * @see java.util.concurrent.ThreadFactory#newThread(java.lang.Runnable)
+                     */
+                    public Thread newThread(Runnable r) {
+                        final Thread t = new Thread(null, r,
+                                              "jackrabbit-pool-" + threadNumber.getAndIncrement(),
+                                              0);
+                        if (t.isDaemon())
+                            t.setDaemon(false);
+                        if (t.getPriority() != Thread.NORM_PRIORITY)
+                            t.setPriority(Thread.NORM_PRIORITY);
+                        t.setContextClassLoader(poolClassLoader);
+                        return t;
+                    }
+                },
                 new ThreadPoolExecutor.CallerRunsPolicy());
         this.executor = executor;
 
@@ -282,7 +306,7 @@
         boolean succeeded = false;
         try {
             this.repConfig = repConfig;
-            
+
             // setup file systems
             repStore = repConfig.getFileSystem();
             String fsRootPath = "/meta";



Mime
View raw message