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 <mumrah@gmail.com>, Divij Vaidya <diviv@amazon.com>, Manyanda Chitimbo <manyanda.chitimbo@gmail.com>
This commit is contained in:
Luke Chen 2023-05-02 09:54:12 +08:00 committed by GitHub
parent 4773961a44
commit 21af1918ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -245,12 +245,12 @@ public final class KafkaEventQueue implements EventQueue {
continue; continue;
} else if (interrupted) { } else if (interrupted) {
remove(eventContext); remove(eventContext);
toDeliver = new InterruptedException(); toDeliver = new InterruptedException("The event handler thread is interrupted");
toRun = eventContext; toRun = eventContext;
continue; continue;
} else if (shuttingDown) { } else if (shuttingDown) {
remove(eventContext); remove(eventContext);
toDeliver = new RejectedExecutionException(); toDeliver = new RejectedExecutionException("The event queue is shutting down");
toRun = eventContext; toRun = eventContext;
continue; continue;
} }
@ -264,7 +264,7 @@ public final class KafkaEventQueue implements EventQueue {
} }
} else { } else {
if (interrupted) { if (interrupted) {
toDeliver = new InterruptedException(); toDeliver = new InterruptedException("The event handler thread is interrupted");
} else { } else {
toDeliver = null; toDeliver = null;
} }
@ -300,10 +300,10 @@ public final class KafkaEventQueue implements EventQueue {
lock.lock(); lock.lock();
try { try {
if (shuttingDown) { if (shuttingDown) {
return new RejectedExecutionException(); return new RejectedExecutionException("The event queue is shutting down");
} }
if (interrupted) { if (interrupted) {
return new InterruptedException(); return new InterruptedException("The event handler thread is interrupted");
} }
OptionalLong existingDeadlineNs = OptionalLong.empty(); OptionalLong existingDeadlineNs = OptionalLong.empty();
if (eventContext.tag != null) { if (eventContext.tag != null) {