lokidundun commented on code in PR #7783:
URL: https://github.com/apache/incubator-seata/pull/7783#discussion_r2527638452
##########
core/src/main/java/org/apache/seata/core/rpc/netty/AbstractNettyRemotingClient.java:
##########
@@ -96,6 +99,10 @@ public abstract class AbstractNettyRemotingClient extends
AbstractNettyRemoting
protected final Condition mergeCondition = mergeLock.newCondition();
protected volatile boolean isSending = false;
+ private final Runnable reconnectTask;
+ private ScheduledExecutorService reconnectTimer;
Review Comment:
> It's probably better to have a globally unique one here, otherwise there
would be multiple reconnectTimers.
Or I think we can tackle like this? What do you think?
```
private volatile ScheduledExecutorService reconnectTimer;
@Override
public void init() {
if (timerStarted.compareAndSet(false, true)) {
mergeLock.lock();
try {
this.reconnectTimer = new ScheduledThreadPoolExecutor(
1, new NamedThreadFactory("Reconnect-Timer-" +
transactionRole.name(), 1));
this.reconnectTimer.scheduleAtFixedRate(
this.reconnectTask, SCHEDULE_DELAY_MILLS,
SCHEDULE_INTERVAL_MILLS, TimeUnit.MILLISECONDS);
LOGGER.info("Instance reconnect timer started (role: {})",
transactionRole.name());
}finally {
mergeLock.unlock();
}
}
if (this.isEnableClientBatchSendRequest()) {
mergeSendExecutorService = new ThreadPoolExecutor(
MAX_MERGE_SEND_THREAD,
MAX_MERGE_SEND_THREAD,
KEEP_ALIVE_TIME,
TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>(),
new NamedThreadFactory(getThreadPrefix(),
MAX_MERGE_SEND_THREAD));
mergeSendExecutorService.submit(new MergedSendRunnable());
}
super.init();
clientBootstrap.start();
}
```
--
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]