From c37c62323c311afd7bbd07d15927b2fd5a65d5ec Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Tue, 17 Sep 2019 12:41:06 +1000 Subject: [PATCH] updates from review Signed-off-by: Greg Wilkins --- .../jetty/util/thread/ScheduledExecutorScheduler.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ScheduledExecutorScheduler.java b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ScheduledExecutorScheduler.java index 90a629b5205..891b6f6d9f7 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ScheduledExecutorScheduler.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ScheduledExecutorScheduler.java @@ -24,7 +24,7 @@ import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import org.eclipse.jetty.util.ProcessorUtils; +import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.annotation.Name; import org.eclipse.jetty.util.component.AbstractLifeCycle; import org.eclipse.jetty.util.component.Dumpable; @@ -83,7 +83,7 @@ public class ScheduledExecutorScheduler extends AbstractLifeCycle implements Sch */ public ScheduledExecutorScheduler(@Name("name") String name, @Name("daemon") boolean daemon, @Name("classLoader") ClassLoader classLoader, @Name("threadGroup") ThreadGroup threadGroup, @Name("threads") int threads) { - this.name = name == null ? "Scheduler-" + hashCode() : name; + this.name = StringUtil.isBlank(name) ? "Scheduler-" + hashCode() : name; this.daemon = daemon; this.classloader = classLoader == null ? Thread.currentThread().getContextClassLoader() : classLoader; this.threadGroup = threadGroup; @@ -93,7 +93,7 @@ public class ScheduledExecutorScheduler extends AbstractLifeCycle implements Sch @Override protected void doStart() throws Exception { - int size = threads > 0 ? threads : Math.max(1, ProcessorUtils.availableProcessors() / 4); + int size = threads > 0 ? threads : 1; scheduler = new ScheduledThreadPoolExecutor(size, r -> { Thread thread = ScheduledExecutorScheduler.this.thread = new Thread(threadGroup, r, name + "-" + count.incrementAndGet());