You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/07/28 16:02:11 UTC

[lucene-solr] branch reference_impl_dev updated: @427 Change this test a bit again.

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/reference_impl_dev by this push:
     new e3a29dc  @427 Change this test a bit again.
e3a29dc is described below

commit e3a29dc2e27ecb9f32d662efa41263e37b57e096
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Tue Jul 28 11:00:47 2020 -0500

    @427 Change this test a bit again.
---
 .../src/test/org/apache/solr/util/OrderedExecutorTest.java    | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/solr/core/src/test/org/apache/solr/util/OrderedExecutorTest.java b/solr/core/src/test/org/apache/solr/util/OrderedExecutorTest.java
index 8ca9aee..65265ad 100644
--- a/solr/core/src/test/org/apache/solr/util/OrderedExecutorTest.java
+++ b/solr/core/src/test/org/apache/solr/util/OrderedExecutorTest.java
@@ -118,7 +118,7 @@ public class OrderedExecutorTest extends SolrTestCase {
   }
 
   @Test
-  public void testRunInParallel() {
+  public void testRunInParallel() throws ExecutionException, InterruptedException {
     final int parallelism = atLeast(3);
 
     final OrderedExecutor orderedExecutor = new OrderedExecutor
@@ -131,10 +131,10 @@ public class OrderedExecutorTest extends SolrTestCase {
       final CyclicBarrier barrier = new CyclicBarrier(parallelism + 1);
       final CountDownLatch preBarrierLatch = new CountDownLatch(parallelism);
       final CountDownLatch postBarrierLatch = new CountDownLatch(parallelism);
-      
+      List<Future> futures = new ArrayList<>();
       for (int i = 0; i < parallelism; i++) {
         final int lockId = i;
-        testExecutor.execute(() -> {
+        futures.add(testExecutor.submit(() -> {
             orderedExecutor.execute(lockId, () -> {
                 try {
                   log.info("Worker #{} starting", lockId);
@@ -150,7 +150,7 @@ public class OrderedExecutorTest extends SolrTestCase {
                   Thread.currentThread().interrupt();
                 }
               });
-          });
+          }));
       }
 
       if (log.isInfoEnabled()) {
@@ -202,6 +202,9 @@ public class OrderedExecutorTest extends SolrTestCase {
         Thread.currentThread().interrupt();
         fail("interupt while trying to release the barrier and await the postBarrierLatch");
       }
+      for (Future future : futures) {
+        future.get();
+      }
     } finally {
       ParWork.close(orderedExecutor);
     }