You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ma...@apache.org on 2016/04/20 16:29:46 UTC

[1/4] activemq-artemis git commit: This closes #468

Repository: activemq-artemis
Updated Branches:
  refs/heads/master 725379920 -> 0a719e08e


This closes #468


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/0a719e08
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/0a719e08
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/0a719e08

Branch: refs/heads/master
Commit: 0a719e08edf6de317c9576ef717bd91b53d4bb66
Parents: 7253799 ec4cbf7
Author: Martyn Taylor <mt...@redhat.com>
Authored: Wed Apr 20 15:29:25 2016 +0100
Committer: Martyn Taylor <mt...@redhat.com>
Committed: Wed Apr 20 15:29:25 2016 +0100

----------------------------------------------------------------------
 .../artemis/api/core/client/ActiveMQClient.java | 65 ++++++++++----------
 .../activemq/artemis/ClientThreadPoolsTest.java | 10 ++-
 .../core/remoting/impl/invm/InVMConnector.java  |  4 +-
 .../integration/client/CoreClientTest.java      |  5 +-
 4 files changed, 44 insertions(+), 40 deletions(-)
----------------------------------------------------------------------



[4/4] activemq-artemis git commit: ARTEMIS-485 Allow configuring an unbounded cached global client thread pool

Posted by ma...@apache.org.
ARTEMIS-485 Allow configuring an unbounded cached global client thread pool

Adapted code to handle -1 correctly to configure an unbounded thread pool.
In addition, I removed the capability to reconfigure the max pool size
of existing thread pools, because the global thread pool can either be
an unbounded cached pool, or a bounded fixed size pool.
These 2 kinds of pool also differ in the used blocking queue,
therefore cannot be converted into each other.


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/2360fb4c
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/2360fb4c
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/2360fb4c

Branch: refs/heads/master
Commit: 2360fb4c9f53bef42626828bfaf3c15dd91d98e4
Parents: 7253799
Author: Bernd Gutjahr <be...@hpe.com>
Authored: Fri Apr 15 08:20:05 2016 +0200
Committer: Martyn Taylor <mt...@redhat.com>
Committed: Wed Apr 20 15:29:25 2016 +0100

----------------------------------------------------------------------
 .../artemis/api/core/client/ActiveMQClient.java | 32 +++++++-------------
 1 file changed, 11 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2360fb4c/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java
index b4c83f1..1674a53 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java
@@ -242,48 +242,38 @@ public final class ActiveMQClient {
 
 
    /**
-    * (Re)Initializes the global thread pools properties from System properties.  This method will update the global
-    * thread pool configuration based on defined System properties (or defaults if they are not set) notifying
-    * all globalThreadPoolListeners.  The System properties key names are as follow:
+    * Initializes the global thread pools properties from System properties.  This method will update the global
+    * thread pool configuration based on defined System properties (or defaults if they are not set).
+    * The System properties key names are as follow:
     *
     * ActiveMQClient.THREAD_POOL_MAX_SIZE_PROPERTY_KEY="activemq.artemis.client.global.thread.pool.max.size"
     * ActiveMQClient.SCHEDULED_THREAD_POOL_SIZE_PROPERTY_KEY="activemq.artemis.client.global.scheduled.thread.pool.core.size
     *
-    * The min value for max thread pool size is 2.  Providing a value lower than 2 will be ignored and will defaul to 2.
+    * The min value for max thread pool size is 2. If the value is not -1, but lower than 2, it will be ignored and will default to 2.
+    * A value of -1 configures an unbounded thread pool.
     *
-    * Note.  The ServerLocatorImpl registers a listener and uses it to configure it's global thread pools.  If global
-    * thread pools have already been created, they will be updated with these new values.
+    * Note: If global thread pools have already been created, they will not be updated with these new values.
     */
    public static void initializeGlobalThreadPoolProperties() {
 
-      setGlobalThreadPoolProperties(Integer.valueOf(Integer.valueOf(System.getProperty(ActiveMQClient.THREAD_POOL_MAX_SIZE_PROPERTY_KEY, "" + ActiveMQClient.DEFAULT_GLOBAL_THREAD_POOL_MAX_SIZE))), Integer.valueOf(System.getProperty(ActiveMQClient.SCHEDULED_THREAD_POOL_SIZE_PROPERTY_KEY, "" + ActiveMQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE)));
+      setGlobalThreadPoolProperties(Integer.valueOf(System.getProperty(ActiveMQClient.THREAD_POOL_MAX_SIZE_PROPERTY_KEY, "" + ActiveMQClient.DEFAULT_GLOBAL_THREAD_POOL_MAX_SIZE)), Integer.valueOf(System.getProperty(ActiveMQClient.SCHEDULED_THREAD_POOL_SIZE_PROPERTY_KEY, "" + ActiveMQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE)));
    }
 
    /**
     * Allows programatically configuration of global thread pools properties.  This method will update the global
     * thread pool configuration based on the provided values notifying all globalThreadPoolListeners.
     *
-    * Note.  The ServerLocatorImpl registers a listener and uses it to configure it's global thread pools.  If global
-    * thread pools have already been created, they will be updated with these new values.
+    * Note: If global thread pools have already been created, they will not be updated with these new values.
     *
-    * The min value for max thread pool size is 2.  Providing a value lower than 2 will be ignored and will default to 2.
+    * The min value for globalThreadMaxPoolSize is 2. If the value is not -1, but lower than 2, it will be ignored and will default to 2.
+    * A value of -1 configures an unbounded thread pool.
     */
    public static void setGlobalThreadPoolProperties(int globalThreadMaxPoolSize, int globalScheduledThreadPoolSize) {
 
-      if (globalThreadMaxPoolSize < 2) globalThreadMaxPoolSize = 2;
+      if (globalThreadMaxPoolSize < 2 && globalThreadMaxPoolSize != -1) globalThreadMaxPoolSize = 2;
 
       ActiveMQClient.globalScheduledThreadPoolSize = globalScheduledThreadPoolSize;
       ActiveMQClient.globalThreadMaxPoolSize = globalThreadMaxPoolSize;
-
-      // if injected, we won't do anything with the pool as they're not ours
-      if (!injectedPools) {
-         // Right now I'm ignoring the corePool size on purpose as there's no way to have two values for the number of threads
-         // this is basically a fixed size thread pool (although the pool grows on demand)
-         getGlobalThreadPool().setCorePoolSize(globalThreadMaxPoolSize);
-         getGlobalThreadPool().setMaximumPoolSize(globalThreadMaxPoolSize);
-
-         getGlobalScheduledThreadPool().setCorePoolSize(globalScheduledThreadPoolSize);
-      }
    }
 
    /**


[2/4] activemq-artemis git commit: Protected ActiveMQClient API against misuse.

Posted by ma...@apache.org.
Protected ActiveMQClient API against misuse.

1. Changed public fields in ActiveMQClient to private and added getters.

Exposing fields for thread pool sized allow to modify them in undesired ways.
I made these fields private and added corresponding getter methods.
In addition, I renamed the field 'globalThreadMaxPoolSize'
to 'globalThreadPoolSize' to be more consistent with the
'globalScheduledThreadPoolSize' field name.
I also adapted some tests to always call clearThreadPools after
the thread pool size configuration has been changed.

2. Protect against injecting null as thread pools

ActiveMQClient.injectPools allowed null as injected thread pools.
The effect was that internal threads pools were created,
but not shutdown correctly.


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/1b5396c0
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/1b5396c0
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/1b5396c0

Branch: refs/heads/master
Commit: 1b5396c033774b85eefce150e906117928cda75b
Parents: 2360fb4
Author: Bernd Gutjahr <be...@hpe.com>
Authored: Fri Apr 15 09:14:30 2016 +0200
Committer: Martyn Taylor <mt...@redhat.com>
Committed: Wed Apr 20 15:29:25 2016 +0100

----------------------------------------------------------------------
 .../artemis/api/core/client/ActiveMQClient.java | 23 +++++++++++++-------
 .../activemq/artemis/ClientThreadPoolsTest.java |  8 +++++--
 .../core/remoting/impl/invm/InVMConnector.java  |  4 ++--
 .../integration/client/CoreClientTest.java      |  5 +++--
 4 files changed, 26 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1b5396c0/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java
index 1674a53..abc3a5d 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java
@@ -46,9 +46,9 @@ import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
  */
 public final class ActiveMQClient {
 
-   public static int globalThreadMaxPoolSize;
+   private static int globalThreadPoolSize;
 
-   public static int globalScheduledThreadPoolSize;
+   private static int globalScheduledThreadPoolSize;
 
    public static final String DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME = RoundRobinConnectionLoadBalancingPolicy.class.getCanonicalName();
 
@@ -195,13 +195,15 @@ public final class ActiveMQClient {
    }
 
    /** Warning: This method has to be called before any clients or servers is started on the JVM otherwise previous ServerLocator would be broken after this call. */
-   public static synchronized void injectPools(ThreadPoolExecutor globalThreadPool, ScheduledThreadPoolExecutor scheduledThreadPoolExecutor) {
+   public static synchronized void injectPools(ThreadPoolExecutor globalThreadPool, ScheduledThreadPoolExecutor scheduledThreadPool) {
+      if (globalThreadPool == null || scheduledThreadPool == null)
+         throw new IllegalArgumentException("thread pools must not be null");
 
       // We call clearThreadPools as that will shutdown any previously used executor
       clearThreadPools();
 
       ActiveMQClient.globalThreadPool = globalThreadPool;
-      ActiveMQClient.globalScheduledThreadPool = scheduledThreadPoolExecutor;
+      ActiveMQClient.globalScheduledThreadPool = scheduledThreadPool;
       injectedPools = true;
    }
 
@@ -214,11 +216,11 @@ public final class ActiveMQClient {
             }
          });
 
-         if (globalThreadMaxPoolSize == -1) {
+         if (globalThreadPoolSize == -1) {
             globalThreadPool = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), factory);
          }
          else {
-            globalThreadPool = new ThreadPoolExecutor(ActiveMQClient.globalThreadMaxPoolSize, ActiveMQClient.globalThreadMaxPoolSize, 1L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), factory);
+            globalThreadPool = new ThreadPoolExecutor(ActiveMQClient.globalThreadPoolSize, ActiveMQClient.globalThreadPoolSize, 1L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), factory);
          }
       }
       return globalThreadPool;
@@ -238,8 +240,13 @@ public final class ActiveMQClient {
       return globalScheduledThreadPool;
    }
 
+   public static int getGlobalThreadPoolSize() {
+      return globalThreadPoolSize;
+   }
 
-
+   public static int getGlobalScheduledThreadPoolSize() {
+      return globalScheduledThreadPoolSize;
+   }
 
    /**
     * Initializes the global thread pools properties from System properties.  This method will update the global
@@ -273,7 +280,7 @@ public final class ActiveMQClient {
       if (globalThreadMaxPoolSize < 2 && globalThreadMaxPoolSize != -1) globalThreadMaxPoolSize = 2;
 
       ActiveMQClient.globalScheduledThreadPoolSize = globalScheduledThreadPoolSize;
-      ActiveMQClient.globalThreadMaxPoolSize = globalThreadMaxPoolSize;
+      ActiveMQClient.globalThreadPoolSize = globalThreadMaxPoolSize;
    }
 
    /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1b5396c0/artemis-core-client/src/test/java/org/apache/activemq/artemis/ClientThreadPoolsTest.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/test/java/org/apache/activemq/artemis/ClientThreadPoolsTest.java b/artemis-core-client/src/test/java/org/apache/activemq/artemis/ClientThreadPoolsTest.java
index 57399cd..a3dc213 100644
--- a/artemis-core-client/src/test/java/org/apache/activemq/artemis/ClientThreadPoolsTest.java
+++ b/artemis-core-client/src/test/java/org/apache/activemq/artemis/ClientThreadPoolsTest.java
@@ -54,7 +54,7 @@ public class ClientThreadPoolsTest {
       System.clearProperty(ActiveMQClient.SCHEDULED_THREAD_POOL_SIZE_PROPERTY_KEY);
       ActiveMQClient.initializeGlobalThreadPoolProperties();
       ActiveMQClient.clearThreadPools();
-      Assert.assertEquals(ActiveMQClient.DEFAULT_GLOBAL_THREAD_POOL_MAX_SIZE, ActiveMQClient.globalThreadMaxPoolSize);
+      Assert.assertEquals(ActiveMQClient.DEFAULT_GLOBAL_THREAD_POOL_MAX_SIZE, ActiveMQClient.getGlobalThreadPoolSize());
    }
 
    @Test
@@ -65,14 +65,15 @@ public class ClientThreadPoolsTest {
       System.setProperty(ActiveMQClient.THREAD_POOL_MAX_SIZE_PROPERTY_KEY, "" + threadPoolMaxSize);
       System.setProperty(ActiveMQClient.SCHEDULED_THREAD_POOL_SIZE_PROPERTY_KEY, "" + scheduledThreadPoolSize);
       ActiveMQClient.initializeGlobalThreadPoolProperties();
+      ActiveMQClient.clearThreadPools();
 
       testSystemPropertiesThreadPoolSettings(threadPoolMaxSize, scheduledThreadPoolSize);
    }
 
    @Test
    public void testShutdownPoolInUse() throws Exception {
-      ActiveMQClient.clearThreadPools();
       ActiveMQClient.setGlobalThreadPoolProperties(10, 1);
+      ActiveMQClient.clearThreadPools();
 
       final CountDownLatch inUse = new CountDownLatch(1);
       final CountDownLatch neverLeave = new CountDownLatch(1);
@@ -146,6 +147,7 @@ public class ClientThreadPoolsTest {
       int testScheduleSize = 9;
 
       ActiveMQClient.setGlobalThreadPoolProperties(testMaxSize, testScheduleSize);
+      ActiveMQClient.clearThreadPools();
       testSystemPropertiesThreadPoolSettings(testMaxSize, testScheduleSize);
    }
 
@@ -156,6 +158,7 @@ public class ClientThreadPoolsTest {
       int testScheduleSize = 9;
 
       ActiveMQClient.setGlobalThreadPoolProperties(testMaxSize, testScheduleSize);
+      ActiveMQClient.clearThreadPools();
       testSystemPropertiesThreadPoolSettings(testMaxSize, testScheduleSize);
    }
 
@@ -255,6 +258,7 @@ public class ClientThreadPoolsTest {
       // Resets the global thread pool properties back to default.
       System.setProperties(systemProperties);
       ActiveMQClient.initializeGlobalThreadPoolProperties();
+      ActiveMQClient.clearThreadPools();
    }
 
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1b5396c0/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java
index 9f965ea..d39b8c6 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java
@@ -103,11 +103,11 @@ public class InVMConnector extends AbstractConnector {
 
    private static synchronized ExecutorService getInVMExecutor() {
       if (threadPoolExecutor == null) {
-         if (ActiveMQClient.globalThreadMaxPoolSize <= -1) {
+         if (ActiveMQClient.getGlobalThreadPoolSize() <= -1) {
             threadPoolExecutor = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), Executors.defaultThreadFactory());
          }
          else {
-            threadPoolExecutor = Executors.newFixedThreadPool(ActiveMQClient.globalThreadMaxPoolSize);
+            threadPoolExecutor = Executors.newFixedThreadPool(ActiveMQClient.getGlobalThreadPoolSize());
          }
       }
       return threadPoolExecutor;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1b5396c0/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CoreClientTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CoreClientTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CoreClientTest.java
index a4ef71a..c9b8944 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CoreClientTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CoreClientTest.java
@@ -74,11 +74,12 @@ public class CoreClientTest extends ActiveMQTestBase {
    @Test
    public void testCoreClientWithGlobalThreadPoolParamtersChanged() throws Exception {
 
-      int originalScheduled = ActiveMQClient.globalScheduledThreadPoolSize;
-      int originalGlobal = ActiveMQClient.globalThreadMaxPoolSize;
+      int originalScheduled = ActiveMQClient.getGlobalScheduledThreadPoolSize();
+      int originalGlobal = ActiveMQClient.getGlobalThreadPoolSize();
 
       try {
          ActiveMQClient.setGlobalThreadPoolProperties(2, 1);
+         ActiveMQClient.clearThreadPools();
          ServerLocator locator = createNonHALocator(false);
          testCoreClient(true, locator);
       }


[3/4] activemq-artemis git commit: abstracted global client thread pools from ThreadPoolExecutor as implementation

Posted by ma...@apache.org.
abstracted global client thread pools from ThreadPoolExecutor as implementation

Changed the ActiveMQClient interface to expose global thread pools as
ExecutorService and ScheduledExecutorService interface. This is necessary
to allow injecting thread pool implementations that are not based on
ThreadPoolExecutor or ScheduledThreadPoolExecutor.


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/ec4cbf7b
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/ec4cbf7b
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/ec4cbf7b

Branch: refs/heads/master
Commit: ec4cbf7b34b19dbd9b4b542067461c2593380cc7
Parents: 1b5396c
Author: Bernd Gutjahr <be...@hpe.com>
Authored: Tue Apr 19 13:55:30 2016 +0200
Committer: Martyn Taylor <mt...@redhat.com>
Committed: Wed Apr 20 15:29:25 2016 +0100

----------------------------------------------------------------------
 .../artemis/api/core/client/ActiveMQClient.java         | 12 +++++++-----
 .../apache/activemq/artemis/ClientThreadPoolsTest.java  |  2 +-
 2 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec4cbf7b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java
index abc3a5d..3f5dcb9 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java
@@ -19,7 +19,9 @@ package org.apache.activemq.artemis.api.core.client;
 import java.net.URI;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.concurrent.ExecutorService;
 import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.ThreadFactory;
@@ -136,11 +138,11 @@ public final class ActiveMQClient {
 
    public static final String SCHEDULED_THREAD_POOL_SIZE_PROPERTY_KEY = "activemq.artemis.client.global.scheduled.thread.pool.core.size";
 
-   private static ThreadPoolExecutor globalThreadPool;
+   private static ExecutorService globalThreadPool;
 
    private static boolean injectedPools = false;
 
-   private static ScheduledThreadPoolExecutor globalScheduledThreadPool;
+   private static ScheduledExecutorService globalScheduledThreadPool;
 
 
    static {
@@ -195,7 +197,7 @@ public final class ActiveMQClient {
    }
 
    /** Warning: This method has to be called before any clients or servers is started on the JVM otherwise previous ServerLocator would be broken after this call. */
-   public static synchronized void injectPools(ThreadPoolExecutor globalThreadPool, ScheduledThreadPoolExecutor scheduledThreadPool) {
+   public static synchronized void injectPools(ExecutorService globalThreadPool, ScheduledExecutorService scheduledThreadPool) {
       if (globalThreadPool == null || scheduledThreadPool == null)
          throw new IllegalArgumentException("thread pools must not be null");
 
@@ -207,7 +209,7 @@ public final class ActiveMQClient {
       injectedPools = true;
    }
 
-   public static synchronized ThreadPoolExecutor getGlobalThreadPool() {
+   public static synchronized ExecutorService getGlobalThreadPool() {
       if (globalThreadPool == null) {
          ThreadFactory factory = AccessController.doPrivileged(new PrivilegedAction<ThreadFactory>() {
             @Override
@@ -226,7 +228,7 @@ public final class ActiveMQClient {
       return globalThreadPool;
    }
 
-   public static synchronized ScheduledThreadPoolExecutor getGlobalScheduledThreadPool() {
+   public static synchronized ScheduledExecutorService getGlobalScheduledThreadPool() {
       if (globalScheduledThreadPool == null) {
          ThreadFactory factory = AccessController.doPrivileged(new PrivilegedAction<ThreadFactory>() {
             @Override

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec4cbf7b/artemis-core-client/src/test/java/org/apache/activemq/artemis/ClientThreadPoolsTest.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/test/java/org/apache/activemq/artemis/ClientThreadPoolsTest.java b/artemis-core-client/src/test/java/org/apache/activemq/artemis/ClientThreadPoolsTest.java
index a3dc213..f9cd852 100644
--- a/artemis-core-client/src/test/java/org/apache/activemq/artemis/ClientThreadPoolsTest.java
+++ b/artemis-core-client/src/test/java/org/apache/activemq/artemis/ClientThreadPoolsTest.java
@@ -177,7 +177,7 @@ public class ClientThreadPoolsTest {
       threadPoolField.setAccessible(true);
       scheduledThreadPoolField.setAccessible(true);
 
-      ThreadPoolExecutor threadPool = ActiveMQClient.getGlobalThreadPool();
+      ThreadPoolExecutor threadPool = (ThreadPoolExecutor) ActiveMQClient.getGlobalThreadPool();
 
       final CountDownLatch doneMax = new CountDownLatch(expectedMax);
       final CountDownLatch latch = new CountDownLatch(1);