This is an automated email from the ASF dual-hosted git repository.
tanxinyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new acda1a0f092 Make log dispatcher stop in parallel #13588
acda1a0f092 is described below
commit acda1a0f092f540dc29e8814ec7cb94d41f85bc6
Author: Li Yu Heng <[email protected]>
AuthorDate: Mon Sep 23 20:42:13 2024 +0800
Make log dispatcher stop in parallel #13588
---
.../iotdb/consensus/iot/logdispatcher/LogDispatcher.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git
a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/logdispatcher/LogDispatcher.java
b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/logdispatcher/LogDispatcher.java
index a62bdd4e132..6b33fcc5dfc 100644
---
a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/logdispatcher/LogDispatcher.java
+++
b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/logdispatcher/LogDispatcher.java
@@ -104,7 +104,8 @@ public class LogDispatcher {
public synchronized void stop() {
if (!threads.isEmpty()) {
- threads.forEach(LogDispatcherThread::stop);
+ threads.forEach(LogDispatcherThread::setStopped);
+ threads.forEach(LogDispatcherThread::processStopped);
executorService.shutdownNow();
int timeout = 10;
try {
@@ -300,7 +301,15 @@ public class LogDispatcher {
}
public void stop() {
+ setStopped();
+ processStopped();
+ }
+
+ private void setStopped() {
stopped = true;
+ }
+
+ private void processStopped() {
try {
if (!runFinished.await(30, TimeUnit.SECONDS)) {
logger.info("{}: Dispatcher for {} didn't stop after 30s.",
impl.getThisNode(), peer);