diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestWeakObjectPool.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestWeakObjectPool.java index 9dbbbd093a5..12d98773879 100644 --- a/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestWeakObjectPool.java +++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestWeakObjectPool.java @@ -22,15 +22,20 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; +import org.apache.hadoop.hbase.CategoryBasedTimeout; import org.apache.hadoop.hbase.testclassification.MiscTests; import org.apache.hadoop.hbase.testclassification.SmallTests; import org.junit.Assert; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.junit.experimental.categories.Category; +import org.junit.rules.TestRule; @Category({MiscTests.class, SmallTests.class}) public class TestWeakObjectPool { + @Rule public final TestRule timeout = CategoryBasedTimeout.builder().withTimeout(this.getClass()). + withLookingForStuckThread(true).build(); ObjectPool pool; @Before @@ -89,7 +94,7 @@ public class TestWeakObjectPool { Assert.assertNotEquals(hash1, System.identityHashCode(obj3)); } - @Test(timeout=1000) + @Test public void testCongestion() throws Exception { final int THREAD_COUNT = 100;