Author: darran.lofthouse(a)jboss.com
Date: 2010-08-09 15:08:40 -0400 (Mon, 09 Aug 2010)
New Revision: 12764
Modified:
stack/native/branches/jbossws-native-3.1.2.SP3-patch-02_JBPAPP-4610/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java
Log:
[JBPAPP-4610] Removed default initialisation of an Executor
Modified:
stack/native/branches/jbossws-native-3.1.2.SP3-patch-02_JBPAPP-4610/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2.SP3-patch-02_JBPAPP-4610/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java 2010-08-09
17:32:41 UTC (rev 12763)
+++
stack/native/branches/jbossws-native-3.1.2.SP3-patch-02_JBPAPP-4610/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java 2010-08-09
19:08:40 UTC (rev 12764)
@@ -95,8 +95,11 @@
// provide logging
private final Logger log = Logger.getLogger(ServiceDelegateImpl.class);
+ // Lock to ensure only one thread can initialise the defaultExecutor.
+ private static final Object DEFAULT_EXECUTOR_LOCK = new Object();
// The executor service
- private static ExecutorService defaultExecutor = Executors.newCachedThreadPool();
+ private static ExecutorService defaultExecutor = null;
+
// The service meta data that is associated with this JAXWS Service
private ServiceMetaData serviceMetaData;
// The ServiceRefMetaData supplied by the ServiceObjectFactory
@@ -363,12 +366,32 @@
this.handlerResolver = handlerResolver;
}
+ private ExecutorService getDefaultExecutor()
+ {
+ if (defaultExecutor == null)
+ {
+ synchronized (DEFAULT_EXECUTOR_LOCK)
+ {
+ if (defaultExecutor == null)
+ {
+ defaultExecutor = Executors.newCachedThreadPool();
+ if (log.isTraceEnabled())
+ {
+ log.trace("Created new defaultExecutor", new
Throwable("Call Trace"));
+ }
+ }
+ }
+ }
+
+ return defaultExecutor;
+ }
+
@Override
public Executor getExecutor()
{
if (executor == null)
{
- executor = defaultExecutor;
+ executor = getDefaultExecutor();
}
return executor;
}
Show replies by date