From 21af1918eafa30812a955c3c0295b9e968841cd3 Mon Sep 17 00:00:00 2001 From: Luke Chen Date: Tue, 2 May 2023 09:54:12 +0800 Subject: [PATCH] MINOR: Add reason to exceptions in QuorumController (#13648) Saw this error message in log: ERROR [QuorumController id=1] writeNoOpRecord: unable to start processing because of RejectedExecutionException. Reason: null (org.apache.kafka.controller.QuorumController) The null reason is not helpful with only RejectedExecutionException. Adding the reason to it. Reviewers: David Arthur , Divij Vaidya , Manyanda Chitimbo --- .../java/org/apache/kafka/queue/KafkaEventQueue.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server-common/src/main/java/org/apache/kafka/queue/KafkaEventQueue.java b/server-common/src/main/java/org/apache/kafka/queue/KafkaEventQueue.java index 70f859d9f89..2fde8285dab 100644 --- a/server-common/src/main/java/org/apache/kafka/queue/KafkaEventQueue.java +++ b/server-common/src/main/java/org/apache/kafka/queue/KafkaEventQueue.java @@ -245,12 +245,12 @@ public final class KafkaEventQueue implements EventQueue { continue; } else if (interrupted) { remove(eventContext); - toDeliver = new InterruptedException(); + toDeliver = new InterruptedException("The event handler thread is interrupted"); toRun = eventContext; continue; } else if (shuttingDown) { remove(eventContext); - toDeliver = new RejectedExecutionException(); + toDeliver = new RejectedExecutionException("The event queue is shutting down"); toRun = eventContext; continue; } @@ -264,7 +264,7 @@ public final class KafkaEventQueue implements EventQueue { } } else { if (interrupted) { - toDeliver = new InterruptedException(); + toDeliver = new InterruptedException("The event handler thread is interrupted"); } else { toDeliver = null; } @@ -300,10 +300,10 @@ public final class KafkaEventQueue implements EventQueue { lock.lock(); try { if (shuttingDown) { - return new RejectedExecutionException(); + return new RejectedExecutionException("The event queue is shutting down"); } if (interrupted) { - return new InterruptedException(); + return new InterruptedException("The event handler thread is interrupted"); } OptionalLong existingDeadlineNs = OptionalLong.empty(); if (eventContext.tag != null) {