Issue #300 - improvements to CompressionPool

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2019-07-03 11:51:05 +10:00
parent 2cf0c8aeb8
commit 325a084422
1 changed files with 2 additions and 8 deletions

View File

@ -62,18 +62,12 @@ public abstract class CompressionPool<T> extends AbstractLifeCycle
if (_capacity == 0)
object = newObject();
else if (_capacity < 0)
{
object = _pool.poll();
if (object == null)
object = newObject();
}
else
{
object = _pool.poll();
if (object == null)
object = newObject();
else
else if (_capacity > 0)
_numObjects.decrementAndGet();
}
@ -88,7 +82,7 @@ public abstract class CompressionPool<T> extends AbstractLifeCycle
if (object == null)
return;
if (_capacity == 0 || isStopped())
if (_capacity == 0 || !isRunning())
{
end(object);
return;