From d8d67b6d6d7e0e33fd893f3c3b8b9dfc4f3f8ab4 Mon Sep 17 00:00:00 2001 From: A-Imal Date: Tue, 12 Dec 2023 16:00:29 +0100 Subject: [PATCH] SingleWriterService > Handle all exceptions that can be thrown during the task execution. This allows all futures to finish and issues being visible. --- .../java/com/hivemq/persistence/InMemoryProducerQueues.java | 2 +- src/main/java/com/hivemq/persistence/ProducerQueuesImpl.java | 2 +- src/main/java/com/hivemq/persistence/SingleWriterService.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/hivemq/persistence/InMemoryProducerQueues.java b/src/main/java/com/hivemq/persistence/InMemoryProducerQueues.java index 554e116ac..675f7cb97 100644 --- a/src/main/java/com/hivemq/persistence/InMemoryProducerQueues.java +++ b/src/main/java/com/hivemq/persistence/InMemoryProducerQueues.java @@ -150,7 +150,7 @@ public InMemoryProducerQueues(final int persistenceBucketCount, final int amount } else { successCallback.afterTask(result); } - } catch (final Exception e) { + } catch (final Throwable e) { if (resultFuture != null) { resultFuture.setException(e); } else { diff --git a/src/main/java/com/hivemq/persistence/ProducerQueuesImpl.java b/src/main/java/com/hivemq/persistence/ProducerQueuesImpl.java index bc9db3d63..0b3e28c31 100644 --- a/src/main/java/com/hivemq/persistence/ProducerQueuesImpl.java +++ b/src/main/java/com/hivemq/persistence/ProducerQueuesImpl.java @@ -230,7 +230,7 @@ public void execute(final @NotNull SplittableRandom random) { .afterTask(result)); } } - } catch (final Exception e) { + } catch (final Throwable e) { if (taskWithFuture.getFuture() != null) { taskWithFuture.getFuture().setException(e); } else { diff --git a/src/main/java/com/hivemq/persistence/SingleWriterService.java b/src/main/java/com/hivemq/persistence/SingleWriterService.java index 069ee891e..4a37048df 100644 --- a/src/main/java/com/hivemq/persistence/SingleWriterService.java +++ b/src/main/java/com/hivemq/persistence/SingleWriterService.java @@ -46,6 +46,6 @@ interface SuccessCallback { } interface FailedCallback { - void afterTask(@NotNull Exception exception); + void afterTask(@NotNull Throwable exception); } }