hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From binli...@apache.org
Subject [hbase] branch branch-2 updated: HBASE-23241 TestExecutorService sometimes fail (#782)
Date Mon, 04 Nov 2019 09:19:21 GMT
This is an automated email from the ASF dual-hosted git repository.

binlijin pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new c8c8eef  HBASE-23241 TestExecutorService sometimes fail (#782)
c8c8eef is described below

commit c8c8eef0d472bac33fdb99b8af9026ed12e788c7
Author: binlijin <binlijin@gmail.com>
AuthorDate: Mon Nov 4 17:15:50 2019 +0800

    HBASE-23241 TestExecutorService sometimes fail (#782)
    
    Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org>
---
 .../java/org/apache/hadoop/hbase/executor/TestExecutorService.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/executor/TestExecutorService.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/executor/TestExecutorService.java
index 205c6c6..c93e951 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/executor/TestExecutorService.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/executor/TestExecutorService.java
@@ -30,6 +30,7 @@ import java.io.IOException;
 import java.io.StringWriter;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.hadoop.conf.Configuration;
@@ -231,9 +232,11 @@ public class TestExecutorService {
     executorService.startExecutorService(ExecutorType.MASTER_SNAPSHOT_OPERATIONS, 1);
 
     CountDownLatch latch = new CountDownLatch(1);
+    CountDownLatch waitForEventToStart = new CountDownLatch(1);
     executorService.submit(new EventHandler(server, EventType.C_M_SNAPSHOT_TABLE) {
       @Override
       public void process() throws IOException {
+        waitForEventToStart.countDown();
         try {
           latch.await();
         } catch (InterruptedException e) {
@@ -242,9 +245,11 @@ public class TestExecutorService {
       }
     });
 
+    //Wait EventHandler to start
+    waitForEventToStart.await(10, TimeUnit.SECONDS);
     int activeCount = executorService.getExecutor(ExecutorType.MASTER_SNAPSHOT_OPERATIONS)
         .getThreadPoolExecutor().getActiveCount();
-    Assert.assertEquals(activeCount, 1);
+    Assert.assertEquals(1, activeCount);
     latch.countDown();
     Waiter.waitFor(conf, 3000, () -> {
       int count = executorService.getExecutor(ExecutorType.MASTER_SNAPSHOT_OPERATIONS)


Mime
View raw message