From 0025b8eb0c68f05eefd4aabb788becc2caae88f8 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 29 Nov 2019 16:00:10 +0100 Subject: Change thread pool params; allow more concurrent tasks ...and shorten queue --- .../main/java/org/openslx/taskmanager/main/Taskmanager.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/daemon/src/main/java/org/openslx/taskmanager/main/Taskmanager.java b/daemon/src/main/java/org/openslx/taskmanager/main/Taskmanager.java index 8e55e14..7b854c3 100644 --- a/daemon/src/main/java/org/openslx/taskmanager/main/Taskmanager.java +++ b/daemon/src/main/java/org/openslx/taskmanager/main/Taskmanager.java @@ -26,7 +26,8 @@ public class Taskmanager implements FinishCallback, Runnable private static final Logger log = Logger.getLogger( Taskmanager.class ); - private final ThreadPoolExecutor threadPool = new ThreadPoolExecutor( 4, 16, 1, TimeUnit.MINUTES, new ArrayBlockingQueue( 16 ) ); + private final ThreadPoolExecutor threadPool = new ThreadPoolExecutor( 8, 32, 1, TimeUnit.MINUTES, + new ArrayBlockingQueue( 4 ) ); /** * gson object for (de)serialization @@ -45,9 +46,10 @@ public class Taskmanager implements FinishCallback, Runnable private final Semaphore doCheckForWork = new Semaphore( 0 ); - /* - * Static methods - */ + public Taskmanager() + { + threadPool.allowCoreThreadTimeOut( true ); + } /** * Return the status of the task with the given ID. If the task does not -- cgit v1.2.3-55-g7522