From 626ddc5decad09a0d6660d7a544f750ec42f6472 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Popp Date: Fri, 20 Aug 2021 17:28:53 +0200 Subject: [PATCH] if no site is configured yet, the maximum pool size is set to 1 instead of 0 --- .../redirects/cae/service/RedirectUpdateTaskScheduler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core-redirects-cae/src/main/java/com/tallence/core/redirects/cae/service/RedirectUpdateTaskScheduler.java b/core-redirects-cae/src/main/java/com/tallence/core/redirects/cae/service/RedirectUpdateTaskScheduler.java index 3fc319a..dfeb35b 100644 --- a/core-redirects-cae/src/main/java/com/tallence/core/redirects/cae/service/RedirectUpdateTaskScheduler.java +++ b/core-redirects-cae/src/main/java/com/tallence/core/redirects/cae/service/RedirectUpdateTaskScheduler.java @@ -154,8 +154,8 @@ private ControllingThreadPoolExecutorService newControllingThreadPoolExecutorSer // possible. A SynchronousQueue wil try to pass the tasks to the pool, which can take as many threads as the number // of all sites. if (parallelSiteThreads == null) { - int numberOfSites = sitesService.getSites().size(); - return new ControllingThreadPoolExecutorService(1, numberOfSites, 1L, + int maximumPoolSize = sitesService.getSites().isEmpty() ? 1 : sitesService.getSites().size(); + return new ControllingThreadPoolExecutorService(1, maximumPoolSize, 1L, TimeUnit.SECONDS, new SynchronousQueue<>(), namedThreadFactory, pausableThreadPoolExecutorService); } else {