From 3e199b1dffcad8236fcde5fd34e18acf186a09c8 Mon Sep 17 00:00:00 2001 From: Yannick Welsch Date: Sat, 2 Jul 2016 11:54:52 +0200 Subject: [PATCH] Make testAllOperationsInvoked properly clean up after itself --- .../index/shard/IndexShardOperationsLockTests.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/src/test/java/org/elasticsearch/index/shard/IndexShardOperationsLockTests.java b/core/src/test/java/org/elasticsearch/index/shard/IndexShardOperationsLockTests.java index 9ac9e86fec8..c9bb9e19866 100644 --- a/core/src/test/java/org/elasticsearch/index/shard/IndexShardOperationsLockTests.java +++ b/core/src/test/java/org/elasticsearch/index/shard/IndexShardOperationsLockTests.java @@ -92,10 +92,12 @@ public class IndexShardOperationsLockTests extends ESTestCase { operationThreads.add(thread); } + CountDownLatch blockFinished = new CountDownLatch(1); threadPool.generic().execute(() -> { try { latch.await(); blockAndWait().close(); + blockFinished.countDown(); } catch (InterruptedException e) { throw new RuntimeException(e); } @@ -112,6 +114,8 @@ public class IndexShardOperationsLockTests extends ESTestCase { for (Thread thread : operationThreads) { thread.join(); } + + blockFinished.await(); }