diff --git a/core/wisdom-executors/src/main/java/org/wisdom/executors/Creator.java b/core/wisdom-executors/src/main/java/org/wisdom/executors/Creator.java index f332ef058..eeb9c5e44 100644 --- a/core/wisdom-executors/src/main/java/org/wisdom/executors/Creator.java +++ b/core/wisdom-executors/src/main/java/org/wisdom/executors/Creator.java @@ -124,6 +124,7 @@ private void createExecutor(String name, Configuration conf) { 5, 25, 5000, + true, Integer.MAX_VALUE, Thread.NORM_PRIORITY, ecs); diff --git a/core/wisdom-executors/src/main/java/org/wisdom/executors/ManagedExecutorServiceImpl.java b/core/wisdom-executors/src/main/java/org/wisdom/executors/ManagedExecutorServiceImpl.java index 906e47eda..703b86ce0 100644 --- a/core/wisdom-executors/src/main/java/org/wisdom/executors/ManagedExecutorServiceImpl.java +++ b/core/wisdom-executors/src/main/java/org/wisdom/executors/ManagedExecutorServiceImpl.java @@ -43,6 +43,7 @@ public ManagedExecutorServiceImpl(String name, Configuration configuration, List configuration.getIntegerWithDefault("coreSize", 5), configuration.getIntegerWithDefault("maxSize", 25), configuration.getDuration("keepAlive", TimeUnit.MILLISECONDS, 5000), + configuration.getBooleanWithDefault("allowCoreThreadTimeOut", true), configuration.getIntegerWithDefault("workQueueCapacity", Integer.MAX_VALUE), configuration.getIntegerWithDefault("priority", Thread.NORM_PRIORITY), @@ -56,6 +57,7 @@ public ManagedExecutorServiceImpl( int coreSize, int maxSize, long keepAlive, + boolean allowCoreThreadTimeOut, int workQueueCapacity, int priority, List ecs) { @@ -82,7 +84,7 @@ public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { System.out.println("REJECTED EXECUTION : " + r); } }); - executor.allowCoreThreadTimeOut(true); + executor.allowCoreThreadTimeOut(allowCoreThreadTimeOut); setInternalPool(executor); } diff --git a/core/wisdom-executors/src/test/java/org/wisdom/executors/ManagedExecutorServiceImplTest.java b/core/wisdom-executors/src/test/java/org/wisdom/executors/ManagedExecutorServiceImplTest.java index b2e7f998d..b06b5428e 100644 --- a/core/wisdom-executors/src/test/java/org/wisdom/executors/ManagedExecutorServiceImplTest.java +++ b/core/wisdom-executors/src/test/java/org/wisdom/executors/ManagedExecutorServiceImplTest.java @@ -48,6 +48,7 @@ public class ManagedExecutorServiceImplTest { 10, 25, 1000, + true, 20, Thread.NORM_PRIORITY, null); @@ -328,7 +329,7 @@ public void run() { @Test public void testCreationWithUnboundQueue() throws ExecutionException, InterruptedException { ManagedExecutorServiceImpl service = new ManagedExecutorServiceImpl("unbound", - ManagedExecutorService.ThreadType.POOLED, 60000, 10, 25, 1000, + ManagedExecutorService.ThreadType.POOLED, 60000, 10, 25, 1000, true, Integer.MAX_VALUE, Thread.NORM_PRIORITY, null); assertThat(service.getQueue()).isInstanceOf(LinkedBlockingQueue.class); } @@ -336,7 +337,7 @@ public void testCreationWithUnboundQueue() throws ExecutionException, Interrupte @Test public void testCreationWithHandOffQueue() throws ExecutionException, InterruptedException { ManagedExecutorServiceImpl service = new ManagedExecutorServiceImpl("unbound", - ManagedExecutorService.ThreadType.POOLED, 60000, 10, 25, 1000, + ManagedExecutorService.ThreadType.POOLED, 60000, 10, 25, 1000, true, 0, Thread.NORM_PRIORITY, null); assertThat(service.getQueue()).isInstanceOf(SynchronousQueue.class); }