Make jetty scheduler threads daemon thread

This commit is contained in:
Charles Allen 2015-08-17 17:39:48 -07:00
parent 9ff6a637bb
commit 13773865cf
1 changed files with 5 additions and 0 deletions

View File

@ -51,6 +51,7 @@ import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.util.thread.ScheduledExecutorScheduler;
import javax.servlet.ServletException;
import java.util.Map;
@ -161,6 +162,10 @@ public class JettyServerModule extends JerseyServletModule
final Server server = new Server(threadPool);
// Without this bean set, the default ScheduledExecutorScheduler runs as non-daemon, causing lifecycle hooks to fail
// to fire on main exit. Related bug: https://github.com/druid-io/druid/pull/1627
server.addBean(new ScheduledExecutorScheduler("JettyScheduler", true), true);
ServerConnector connector = new ServerConnector(server);
connector.setPort(node.getPort());
connector.setIdleTimeout(Ints.checkedCast(config.getMaxIdleTime().toStandardDuration().getMillis()));