funky-eyes commented on code in PR #8023:
URL: https://github.com/apache/incubator-seata/pull/8023#discussion_r3151825209
##########
seata-spring-boot-starter/src/main/java/org/apache/seata/spring/boot/autoconfigure/SeataSagaAutoConfiguration.java:
##########
@@ -118,20 +118,13 @@ public ThreadPoolExecutor sagaAsyncThreadPoolExecutor(
SagaAsyncThreadPoolProperties properties,
@Qualifier(SAGA_REJECTED_EXECUTION_HANDLER_BEAN_NAME)
RejectedExecutionHandler rejectedExecutionHandler) {
- ThreadPoolExecutorFactoryBean threadFactory = new
ThreadPoolExecutorFactoryBean();
-
threadFactory.setBeanName("sagaStateMachineThreadPoolExecutorFactory");
- threadFactory.setThreadNamePrefix("sagaAsyncExecute-");
- threadFactory.setCorePoolSize(properties.getCorePoolSize());
- threadFactory.setMaxPoolSize(properties.getMaxPoolSize());
- threadFactory.setKeepAliveSeconds(properties.getKeepAliveTime());
-
- return new ThreadPoolExecutor(
+ return ThreadPoolExecutorFactory.newThreadPoolExecutor(
+ "sagaAsyncExecute",
properties.getCorePoolSize(),
properties.getMaxPoolSize(),
properties.getKeepAliveTime(),
TimeUnit.SECONDS,
new LinkedBlockingQueue<>(),
- threadFactory,
rejectedExecutionHandler);
Review Comment:
> Springs ThreadPoolExecutorFactoryBean produces non-daemon threads by
default, but this overload of ThreadPoolExecutorFactory.newThreadPoolExecutor
defaults to daemon=true. After the switch, in-flight saga branches wont keep
the JVM alive on shutdown. Probably want the explicit-daemon overload with
daemon=false here.
Virtual threads cannot set daemon=true, and it is only reasonable for saga
threads to use daemon=true.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]