public static synchronized void clearThreadPools() { clearThreadPools(10, TimeUnit.SECONDS); }
public static synchronized void clearThreadPools() { ActiveMQClient.clearThreadPools(); }
/** * 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(ExecutorService globalThreadPool, ScheduledExecutorService 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 = scheduledThreadPool; injectedPools = true; }
@Override public void stop(StopContext stopContext) { ActiveMQClient.clearThreadPools(); }
@Override public void stop(StopContext stopContext) { ActiveMQClient.clearThreadPools(); }
public static synchronized void clearThreadPools() { clearThreadPools(10, TimeUnit.SECONDS); }
public static synchronized void clearThreadPools() { ActiveMQClient.clearThreadPools(); }
public static synchronized void clearThreadPools() { clearThreadPools(10, TimeUnit.SECONDS); }
public static synchronized void clearThreadPools() { ActiveMQClient.clearThreadPools(); }
/** * 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(ExecutorService globalThreadPool, ScheduledExecutorService 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 = scheduledThreadPool; injectedPools = true; }
/** * 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(ExecutorService globalThreadPool, ScheduledExecutorService 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 = scheduledThreadPool; injectedPools = true; }
/** * 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(ExecutorService globalThreadPool, ScheduledExecutorService 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 = scheduledThreadPool; injectedPools = true; }
/** * 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(ExecutorService globalThreadPool, ScheduledExecutorService 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 = scheduledThreadPool; injectedPools = true; }
/** * 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(ExecutorService globalThreadPool, ScheduledExecutorService 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 = scheduledThreadPool; injectedPools = true; }
/** * 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(ExecutorService globalThreadPool, ScheduledExecutorService 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 = scheduledThreadPool; injectedPools = true; }
@After public void cleanup() { // Resets the global thread pool properties back to default. System.setProperties(systemProperties); ActiveMQClient.initializeGlobalThreadPoolProperties(); ActiveMQClient.clearThreadPools(); }
@Test public void testSystemPropertyThreadPoolSettings() throws Exception { int threadPoolMaxSize = 100; int scheduledThreadPoolSize = 10; 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); }
@AfterClass public static void tearDown() { System.clearProperty(ActiveMQClient.THREAD_POOL_MAX_SIZE_PROPERTY_KEY); System.clearProperty(ActiveMQClient.SCHEDULED_THREAD_POOL_SIZE_PROPERTY_KEY); ActiveMQClient.initializeGlobalThreadPoolProperties(); ActiveMQClient.clearThreadPools(); Assert.assertEquals(ActiveMQClient.DEFAULT_GLOBAL_THREAD_POOL_MAX_SIZE, ActiveMQClient.getGlobalThreadPoolSize()); }
@Test public void testStaticPropertiesThreadPoolSettings() throws Exception { int testMaxSize = 999; int testScheduleSize = 9; ActiveMQClient.setGlobalThreadPoolProperties(testMaxSize, testScheduleSize); ActiveMQClient.clearThreadPools(); testSystemPropertiesThreadPoolSettings(testMaxSize, testScheduleSize); }
@Test public void testSmallPool() throws Exception { int testMaxSize = 2; int testScheduleSize = 9; ActiveMQClient.setGlobalThreadPoolProperties(testMaxSize, testScheduleSize); ActiveMQClient.clearThreadPools(); testSystemPropertiesThreadPoolSettings(testMaxSize, testScheduleSize); }