diff --git a/core/common/src/test/java/alluxio/util/executor/UniqueBlockingQueueTest.java b/core/common/src/test/java/alluxio/util/executor/UniqueBlockingQueueTest.java index d7b91b7c88ce..ce5318ce0193 100644 --- a/core/common/src/test/java/alluxio/util/executor/UniqueBlockingQueueTest.java +++ b/core/common/src/test/java/alluxio/util/executor/UniqueBlockingQueueTest.java @@ -17,6 +17,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; /** * Tests the {@link UniqueBlockingQueue}. @@ -51,6 +52,14 @@ public void concurrentTest() throws Exception { }); } executor.shutdown(); + try { + if (!executor.awaitTermination(60, TimeUnit.SECONDS)) { + executor.shutdownNow(); + } + } catch (InterruptedException e) { + executor.shutdownNow(); + Thread.currentThread().interrupt(); + } assertEquals(20, test.size()); } }