Caideyipi commented on code in PR #18712:
URL: https://github.com/apache/iotdb/pull/18712#discussion_r4090703296
##########
iotdb-client/subscription/src/main/java/org/apache/iotdb/session/subscription/consumer/base/SubscriptionExecutorServiceManager.java:
##########
@@ -65,6 +66,33 @@ public final class SubscriptionExecutorServiceManager {
DOWNSTREAM_DATA_FLOW_EXECUTOR_NAME,
Math.max(Runtime.getRuntime().availableProcessors(), 1));
+ /** Heartbeat Executor: isolate a slow provider from the heartbeat
control-flow scheduler. */
+ private static final SubscriptionExecutorService HEARTBEAT_EXECUTOR =
+ new SubscriptionExecutorService(HEARTBEAT_EXECUTOR_NAME, 0) {
+ @Override
+ void launchIfNeeded() {
+ if (isShutdown()) {
+ synchronized (this) {
+ if (isShutdown()) {
+ LOGGER.info(SubscriptionMessages.EXECUTOR_LAUNCHING,
this.name, this.corePoolSize);
+ this.executor =
+ Executors.newCachedThreadPool(
+ r -> {
+ final Thread t =
+ new Thread(
+ Thread.currentThread().getThreadGroup(),
+ r,
+ HEARTBEAT_EXECUTOR_NAME,
+ 0);
+ t.setDaemon(true);
+ return t;
+ });
+ }
Review Comment:
Thanks for the suggestion. I checked the Maven module graph: `node-commons`
already depends on `iotdb-subscription`, so adding `node-commons` to this
client module creates a reactor cycle (`iotdb-subscription -> node-commons ->
iotdb-subscription`). I verified this with `mvn validate`. Using the shared
`IoTDBThreadPoolFactory` and `ThreadName` here needs those utilities extracted
into a lower-level module (or the existing dependency direction changed). I am
leaving this discussion open while we decide on that broader module change.
--
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]