This is an automated email from the ASF dual-hosted git repository.
tanxinyu pushed a commit to branch rc/1.3.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rc/1.3.3 by this push:
new 3537a30590f Make log dispatcher stop in parallel #13588 (#13595)
3537a30590f is described below
commit 3537a30590f5fbfd654219d5454652a587444f9b
Author: Li Yu Heng <[email protected]>
AuthorDate: Tue Sep 24 14:27:17 2024 +0800
Make log dispatcher stop in parallel #13588 (#13595)
---
.../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 9ffb29e77f3..68b78ab00b6 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 (!threadSemaphore.tryAcquire(30, TimeUnit.SECONDS)) {
logger.info("{}: Dispatcher for {} didn't stop after 30s.",
impl.getThisNode(), peer);