cxzl25 commented on code in PR #8335:
URL: https://github.com/apache/hudi/pull/8335#discussion_r1165106847
##########
hudi-timeline-service/src/main/java/org/apache/hudi/timeline/service/TimelineService.java:
##########
@@ -342,8 +341,19 @@ private int startServiceOnPort(int port) throws
IOException {
}
public int startService() throws IOException {
- final Server server = timelineServerConf.numThreads == DEFAULT_NUM_THREADS
? new JettyServer(new JavalinConfig()).server() :
- new Server(new QueuedThreadPool(timelineServerConf.numThreads));
+ int maxThreads;
+ if (timelineServerConf.numThreads > 0) {
+ maxThreads = timelineServerConf.numThreads;
+ } else {
+ // io.javalin.jetty.JettyUtil.defaultThreadPool
+ maxThreads = 250;
+ }
+ QueuedThreadPool pool = new QueuedThreadPool(maxThreads, 8, 60_000);
+ pool.setDaemon(true);
+ final Server server = new Server(pool);
+ ScheduledExecutorScheduler scheduler = new
ScheduledExecutorScheduler("TimelineService-JettyScheduler", true, 8);
+ server.addBean(scheduler);
+
Review Comment:
Both `QueuedThreadPool` and `ScheduledExecutorScheduler` inherit
`AbstractLifeCycle`.
When the Server stops, it will stop all the beans that implement `LifeCycle`.
org.eclipse.jetty.server.Server#doStop
org.eclipse.jetty.util.component.ContainerLifeCycle#doStop
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]