DeflaterPoolBenchmark should manage lifecycle of the CompressionPool
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
dd06008ff4
commit
ef816fcc42
|
@ -97,8 +97,11 @@ public abstract class CompressionPool<T> extends AbstractLifeCycle
|
|||
@Override
|
||||
public void doStop() throws Exception
|
||||
{
|
||||
_pool.close();
|
||||
_pool = null;
|
||||
if (_pool != null)
|
||||
{
|
||||
_pool.close();
|
||||
_pool = null;
|
||||
}
|
||||
super.doStop();
|
||||
}
|
||||
|
||||
|
|
|
@ -80,16 +80,17 @@ public class DeflaterPoolBenchmark
|
|||
}
|
||||
|
||||
_pool = new DeflaterPool(capacity, Deflater.DEFAULT_COMPRESSION, true);
|
||||
_pool.start();
|
||||
}
|
||||
|
||||
@TearDown(Level.Trial)
|
||||
public static void stopTrial() throws Exception
|
||||
public void stopTrial() throws Exception
|
||||
{
|
||||
_pool.stop();
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
@BenchmarkMode({Mode.Throughput})
|
||||
@SuppressWarnings("deprecation")
|
||||
public long testPool() throws Exception
|
||||
{
|
||||
DeflaterPool.Entry entry = _pool.acquire();
|
||||
|
|
Loading…
Reference in New Issue