From 7809cb8a0457a9bb264c42a1f7fd38727bb7a327 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Tue, 6 Mar 2018 17:44:38 +0700 Subject: [PATCH] Catch JDK 9 exceptions --- .../filebot/ui/sfv/ChecksumComputationService.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/net/filebot/ui/sfv/ChecksumComputationService.java b/source/net/filebot/ui/sfv/ChecksumComputationService.java index 86211c51..94478b9a 100644 --- a/source/net/filebot/ui/sfv/ChecksumComputationService.java +++ b/source/net/filebot/ui/sfv/ChecksumComputationService.java @@ -1,5 +1,7 @@ package net.filebot.ui.sfv; +import static net.filebot.Logging.*; + import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.util.HashSet; @@ -10,6 +12,7 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import java.util.logging.Level; import net.filebot.Settings; import net.filebot.util.DefaultThreadFactory; @@ -108,8 +111,12 @@ class ChecksumComputationService { public void execute(Runnable command) { int preferredPoolSize = getPreferredPoolSize(); - if (getCorePoolSize() < preferredPoolSize) { - setCorePoolSize(preferredPoolSize); + if (preferredPoolSize > 0 && preferredPoolSize <= getMaximumPoolSize() && getCorePoolSize() < preferredPoolSize) { + try { + setCorePoolSize(preferredPoolSize); + } catch (Exception e) { + log.log(Level.WARNING, "Failed to set core pool size: " + preferredPoolSize, e); + } } synchronized (this) {