Skip to content
Browse files

A patch from Martin Kreidenweis "Delegator creation fails with new Ex…

…ecutionPool on trunk"

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 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


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. 

* 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

git-svn-id: 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 91694e7 commit 83f3d353b0146ce9ae06ffb7c610eb8eca2e5df2 @JacquesLeRoux JacquesLeRoux committed Jan 19, 2013
Showing with 2 additions and 23 deletions.
  1. +2 −23 framework/base/src/org/ofbiz/base/concurrent/
25 framework/base/src/org/ofbiz/base/concurrent/
@@ -18,12 +18,11 @@
package org.ofbiz.base.concurrent;
-import java.lang.Runtime;
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;
@@ -39,7 +38,7 @@
public final class ExecutionPool {
public static final String module = ExecutionPool.class.getName();
- public static final ScheduledExecutorService GLOBAL_EXECUTOR = getExecutor(null, "OFBiz-config", -1, true);
+ public static final ScheduledExecutorService GLOBAL_EXECUTOR = getExecutor(null, "OFBiz-config", -1, false);
protected static class ExecutionPoolThreadFactory implements ThreadFactory {
private final ThreadGroup group;
@@ -60,20 +59,10 @@ public Thread newThread(Runnable r) {
- @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 static ScheduledExecutorService getExecutor(ThreadGroup group, String nam
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) {

0 comments on commit 83f3d35

Please sign in to comment.
Something went wrong with that request. Please try again.