kevinrr888 commented on code in PR #5853:
URL: https://github.com/apache/accumulo/pull/5853#discussion_r2325147593


##########
core/src/test/java/org/apache/accumulo/core/crypto/CryptoTest.java:
##########
@@ -539,14 +540,18 @@ private void testMultipleThreads(Scope scope) throws 
Exception {
 
     var executor = Executors.newCachedThreadPool();
 
-    List<Future<Boolean>> verifyFutures = new ArrayList<>();
+    final int numTasks = 32;
+    List<Future<Boolean>> verifyFutures = new ArrayList<>(numTasks);
+    CountDownLatch startLatch = new CountDownLatch(numTasks);

Review Comment:
   I thought the same, but ran this test @DomGarguilo had which I expected 
deadlock for:
   ```
           ExecutorService service = Executors.newFixedThreadPool(10);
           final int numTasks = 30;
   
           ArrayList<Future<Boolean>> results = new ArrayList<>(numTasks);
           CountDownLatch startSignal = new CountDownLatch(numTasks);
   
           for (int i = 0; i < numTasks; i++) {
             results.add(service.submit(() -> {
               startSignal.countDown();
               startSignal.await();
               assertNotNull(al.getCodec(), al + " should not be null");
               return true;
             }));
           }
           assertEquals(numTasks, results.size());
   ```
   And it surprisingly did not deadlock, so I think the await allows the thread 
to start working on another task in the meantime



-- 
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: notifications-unsubscr...@accumulo.apache.org

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

Reply via email to