ravisharm commented on code in PR #17146: URL: https://github.com/apache/druid/pull/17146#discussion_r1774528132
########## processing/src/test/java/org/apache/druid/concurrent/ExecsTest.java: ########## @@ -118,6 +122,38 @@ public void run() producer.shutdown(); } + @Test + public void testSynchronousQueueSingleThreadedExecutor() throws Exception + { + // The implementation of Execs.newBlockingSingleThreaded() rejectedExecutionHandler should not add tasks when it's in shutDown state + // When capacity is 0, a SynchronousQueue is used and if a task is put in it in ShutDown state, it will forever stuck in WAITING state + // as executor will not take() the task to schedule it. + final ListeningExecutorService intermediateTempExecutor = MoreExecutors.listeningDecorator( + Execs.newBlockingSingleThreaded("[TASK_ID]-appenderator-abandon", 0) + ); + Callable<Void> task = () -> { + try { + Thread.sleep(1000); // Simulate long-running task + } + catch (InterruptedException e) { + Thread.sleep(1500); Review Comment: why do we need sleep() under catch? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org