This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/main by this push:
     new 52bb9d4bda ARTEMIS-5675 Server's VM is not halting when disk is 
disconnected
52bb9d4bda is described below

commit 52bb9d4bdaf21fff30f60dfbdde48c0660b2cea8
Author: Clebert Suconic <[email protected]>
AuthorDate: Mon Sep 22 12:37:30 2025 -0400

    ARTEMIS-5675 Server's VM is not halting when disk is disconnected
---
 .../core/journal/impl/JournalFilesRepository.java  |  2 +-
 .../artemis/core/journal/impl/JournalImpl.java     | 31 ++++++++++++++++------
 2 files changed, 24 insertions(+), 9 deletions(-)

diff --git 
a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFilesRepository.java
 
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFilesRepository.java
index 5329b61ea9..5e5857462d 100644
--- 
a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFilesRepository.java
+++ 
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFilesRepository.java
@@ -151,7 +151,7 @@ public class JournalFilesRepository {
       this.openFilesExecutor = fileExecutor;
    }
 
-   public void clear() throws Exception {
+   public void clear() {
       dataFiles.clear();
 
       freeFiles.clear();
diff --git 
a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
 
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
index ecb8dd6694..ed57e385e2 100644
--- 
a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
+++ 
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
@@ -2688,7 +2688,7 @@ public class JournalImpl extends JournalBase implements 
TestableJournal, Journal
    }
 
    @Override
-   public void flush() throws Exception {
+   public void flush() throws InterruptedException {
       fileFactory.flush();
 
       flushExecutor(appendExecutor);
@@ -2858,16 +2858,21 @@ public class JournalImpl extends JournalBase implements 
TestableJournal, Journal
    }
 
    @Override
-   public synchronized void stop() throws Exception {
+   public synchronized void stop() {
       if (state == JournalState.STOPPED) {
          return;
       }
 
-      flush();
+      try {
+         flush();
+      } catch (InterruptedException e) {
+         logger.debug(e.getMessage(), e);
+         // passing the interrupt forward
+         Thread.currentThread().interrupt();
+      }
 
       setJournalState(JournalState.STOPPED);
 
-
       journalLock.writeLock().lock();
       try {
          try {
@@ -2880,8 +2885,12 @@ public class JournalImpl extends JournalBase implements 
TestableJournal, Journal
 
          fileFactory.deactivateBuffer();
 
-         if (currentFile != null && currentFile.getFile().isOpen()) {
-            currentFile.getFile().close(true, true);
+         try {
+            if (currentFile != null && currentFile.getFile().isOpen()) {
+               currentFile.getFile().close(true, true);
+            }
+         } catch (Exception e) {
+            ActiveMQJournalLogger.LOGGER.errorClosingFile(e);
          }
          filesRepository.clear();
 
@@ -2899,8 +2908,14 @@ public class JournalImpl extends JournalBase implements 
TestableJournal, Journal
       if (providedIOThreadPool == null) {
          threadPool.shutdown();
 
-         if (!threadPool.awaitTermination(120, TimeUnit.SECONDS)) {
-            threadPool.shutdownNow();
+         try {
+            if (!threadPool.awaitTermination(120, TimeUnit.SECONDS)) {
+               threadPool.shutdownNow();
+            }
+         } catch (InterruptedException e) {
+            logger.debug(e.getMessage(), e);
+            // delegating exception to further interrupt
+            Thread.currentThread().interrupt();
          }
          threadPool = null;
          ioExecutorFactory = null;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to