lhotari commented on a change in pull request #10599:
URL: https://github.com/apache/pulsar/pull/10599#discussion_r632971688



##########
File path: 
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/GracefulExecutorServicesShutdownTest.java
##########
@@ -120,25 +121,28 @@ public void shouldWaitForExecutorToTerminate() throws 
ExecutionException, Interr
 
 
     @Test
-    public void shouldTerminateWhenFutureIsCancelled() throws 
InterruptedException {
+    public void shouldTerminateWhenFutureIsCancelled() throws 
InterruptedException, ExecutionException {
         // given
         GracefulExecutorServicesShutdown shutdown = 
GracefulExecutorServicesShutdown.initiate();
         shutdown.timeout(Duration.ofMillis(15000));
         ExecutorService executorService = mock(ExecutorService.class);
         when(executorService.isShutdown()).thenReturn(true);
         AtomicBoolean terminated = new AtomicBoolean();
-        AtomicBoolean awaitTerminationInterrupted = new AtomicBoolean();
+        CompletableFuture<Boolean> awaitTerminationInterrupted = new 
CompletableFuture<>();
         when(executorService.isTerminated()).thenAnswer(invocation -> 
terminated.get());
+        CountDownLatch awaitingTerminationEntered = new CountDownLatch(1);
         when(executorService.awaitTermination(anyLong(), 
any())).thenAnswer(invocation  -> {
             long timeout = invocation.getArgument(0);
             TimeUnit unit = invocation.getArgument(1);
+            awaitingTerminationEntered.countDown();

Review comment:
       > move `awaitingTerminationEntered.countDown();` into try block
   
   Does that make a difference?




-- 
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to