You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2013/01/19 22:11:49 UTC

svn commit: r1435704 - in /ofbiz/branches/release12.04: ./ framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java

Author: jleroux
Date: Sat Jan 19 21:11:48 2013
New Revision: 1435704

URL: http://svn.apache.org/viewvc?rev=1435704&view=rev
Log:
"Applied fix from trunk for revision: 1435701" 
------------------------------------------------------------------------
r1435701 | jleroux | 2013-01-19 22:05:23 +0100 (sam., 19 janv. 2013) | 19 lines

A patch from Martin Kreidenweis  "Delegator creation fails with new ExecutionPool on trunk" https://issues.apache.org/jira/browse/OFBIZ-4335

The problem is that the wrong class loader is used for the "ofbiz-config-*" threads (NativeLibClassLoader instead of CachedClassLoader). This happens when the threads are created by the static code in ExecutionPool.java when it is executed before the ClassLoaderContainer.init() initializes the CachedClassLoader.

This also causes other problems like: The local resolution of XML Schema files won't work any more because it's also using the wrong classloader, which can't find the XSD files:

[java] 2011-07-21 12:21:45,333 (ofbiz-config-0) [                 UtilXml:1022:WARN ] [UtilXml.LocalResolver.resolveEntity] could not find LOCAL DTD/Schema with publicId [null] and the file/resource is [service-eca.xsd]

You can trigger this behavior in current ofbiz trunk by setting an expire time for the properties cache in cache.properties

properties.UtilPropertiesResourceCache.expireTime=10000

The Debug.log() statements in the ContainerLoader then load the logging configuration properties file and cache it. If an expire time is set, the ExecutionPool is used and creates the "ofbiz-config-*" threads too early.

By not pre-starting the "ofbiz-config-*" threads in the static code (patch above), the threads are then created later on, when the "main" thread classloader has become the CachedClassLoader and everythings starts working again. 

jleroux: 
* I don't see any issues, but performance, to not start the whole core threads. This is BTW the default behaviour. So I'd recommend to use it for GLOBAL_EXECUTOR.
* I also removed the useless deprecated methods
------------------------------------------------------------------------


Modified:
    ofbiz/branches/release12.04/   (props changed)
    ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java

Propchange: ofbiz/branches/release12.04/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1435701

Modified: ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java?rev=1435704&r1=1435703&r2=1435704&view=diff
==============================================================================
--- ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java (original)
+++ ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java Sat Jan 19 21:11:48 2013
@@ -18,12 +18,11 @@
  *******************************************************************************/
 package org.ofbiz.base.concurrent;
 
-import java.lang.management.ManagementFactory;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
-import java.util.concurrent.Delayed;
 import java.util.concurrent.DelayQueue;
+import java.util.concurrent.Delayed;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.concurrent.ScheduledExecutorService;
@@ -60,20 +59,10 @@ public final class ExecutionPool {
         }
     }
 
-    @Deprecated
-    public static ThreadFactory createThreadFactory(String namePrefix) {
-        return createThreadFactory(null, namePrefix);
-    }
-
     public static ThreadFactory createThreadFactory(ThreadGroup group, String namePrefix) {
         return new ExecutionPoolThreadFactory(group, namePrefix);
     }
 
-    @Deprecated
-    public static ScheduledExecutorService getExecutor(String namePrefix, int threadCount) {
-        return getExecutor(null, namePrefix, threadCount, true);
-    }
-
     public static ScheduledExecutorService getExecutor(ThreadGroup group, String namePrefix, int threadCount, boolean preStart) {
         if (threadCount == 0) {
             threadCount = 1;
@@ -89,16 +78,6 @@ public final class ExecutionPool {
         return executor;
     }
 
-    @Deprecated
-    public static ScheduledExecutorService getNewExactExecutor(String namePrefix) {
-        return getExecutor(null, namePrefix, -1, true);
-    }
-
-    @Deprecated
-    public static ScheduledExecutorService getNewOptimalExecutor(String namePrefix) {
-        return getExecutor(null, namePrefix, -2, true);
-    }
-
     public static <F> List<F> getAllFutures(Collection<Future<F>> futureList) {
         List<F> result = FastList.newInstance();
         for (Future<F> future: futureList) {