diff --git a/src/test/java/org/apache/hadoop/hbase/io/hfile/CacheTestUtils.java b/src/test/java/org/apache/hadoop/hbase/io/hfile/CacheTestUtils.java index 895a9fe..ed31503 100644 --- a/src/test/java/org/apache/hadoop/hbase/io/hfile/CacheTestUtils.java +++ b/src/test/java/org/apache/hadoop/hbase/io/hfile/CacheTestUtils.java @@ -56,7 +56,12 @@ public class CacheTestUtils { @Override public void doAnAction() throws Exception { if (!blocksToTest.isEmpty()) { - HFileBlockPair ourBlock = blocksToTest.remove(); + HFileBlockPair ourBlock = blocksToTest.poll(); + //if we run out of blocks to test, then we should stop the tests. + if(ourBlock == null){ + ctx.stop(); + return; + } toBeTested.cacheBlock(ourBlock.blockName, ourBlock.block); Cacheable retrievedBlock = toBeTested.getBlock(ourBlock.blockName, false);