dimas-b commented on code in PR #4543:
URL: https://github.com/apache/polaris/pull/4543#discussion_r3307449558


##########
persistence/nosql/async/java/src/main/java/org/apache/polaris/nosql/async/java/JavaPoolAsyncExec.java:
##########
@@ -239,7 +240,17 @@ public Cancelable<Void> schedulePeriodic(
 
   @SuppressWarnings("FutureReturnValueIgnored")
   private void immediate(CancelableFuture<?> cancelable) {
-    executorService.submit(cancelable);
+    try {
+      executorService.submit(cancelable);
+    } catch (RejectedExecutionException e) {
+      if (!cancelable.cancelledOrShutdown()) {

Review Comment:
   why? Do we expect it to be cancelled during submission?



##########
persistence/nosql/async/java/src/test/java/org/apache/polaris/nosql/async/java/TestJavaPoolAsyncExec.java:
##########
@@ -143,11 +141,12 @@ public void 
immediateTaskRejectedWhenThreadPoolIsSaturated() throws Exception {
               });
 
       assertThat(started.await(5_000, MILLISECONDS)).isTrue();
-      assertThatThrownBy(() -> executor.submit(() -> "rejected"))
-          .isInstanceOf(RejectedExecutionException.class);
+      var delayed = executor.submit(() -> 
"delayed").completionStage().toCompletableFuture();
+      assertThat(delayed).isNotDone();

Review Comment:
   Isn't it flaky in case of ~100ms "pauses" of the test thread?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to