Skip to content

Commit

Permalink
updates from review
Browse files Browse the repository at this point in the history
Signed-off-by: Greg Wilkins <gregw@webtide.com>
  • Loading branch information
gregw committed Sep 17, 2019
1 parent bcf6b4c commit c37c623
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
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;
Expand Down Expand Up @@ -83,7 +83,7 @@ public ScheduledExecutorScheduler(String name, boolean daemon, ClassLoader class
*/
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;
Expand All @@ -93,7 +93,7 @@ public ScheduledExecutorScheduler(@Name("name") String name, @Name("daemon") boo
@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());
Expand Down

0 comments on commit c37c623

Please sign in to comment.