@Test
    public void testInterruptedExceptionHandling() throws Exception {
        try (KafkaEventQueue queue = new KafkaEventQueue(Time.SYSTEM, logContext, "testInterruptedExceptionHandling")) {
            CompletableFuture<Thread> queueThread = new CompletableFuture<>();
            AtomicInteger numCallsToRun = new AtomicInteger(0);
            AtomicInteger numInterruptedExceptionsSeen = new AtomicInteger(0);
            queue.append(new InterruptibleEvent(queueThread, numCallsToRun, numInterruptedExceptionsSeen));
            queue.append(new InterruptibleEvent(queueThread, numCallsToRun, numInterruptedExceptionsSeen));
            queue.append(new InterruptibleEvent(queueThread, numCallsToRun, numInterruptedExceptionsSeen));
            queue.append(new InterruptibleEvent(queueThread, numCallsToRun, numInterruptedExceptionsSeen));
            queueThread.get().interrupt();
            TestUtils.retryOnExceptionWithTimeout(30000,
                    () -> assertEquals(1, numCallsToRun.get()));
            TestUtils.retryOnExceptionWithTimeout(30000,
                    () -> assertEquals(3, numInterruptedExceptionsSeen.get()));
        }
    }
Test that we continue handling events after Event#handleException itself throws an exception.
server-common/src/test/java/org/apache/kafka/queue/KafkaEventQueueTest.java