Removed deprecations after merge.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
parent
234d3e224b
commit
0b20312bcc
|
@ -131,7 +131,7 @@ public class ArrayByteBufferPool extends AbstractByteBufferPool
|
||||||
|
|
||||||
private Bucket newBucket(int key)
|
private Bucket newBucket(int key)
|
||||||
{
|
{
|
||||||
return new Bucket(this, key * getCapacityFactor(), getMaxQueueLength());
|
return new Bucket(key * getCapacityFactor(), getMaxQueueLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -135,15 +135,13 @@ public interface ByteBufferPool
|
||||||
public static class Bucket
|
public static class Bucket
|
||||||
{
|
{
|
||||||
private final Deque<ByteBuffer> _queue = new ConcurrentLinkedDeque<>();
|
private final Deque<ByteBuffer> _queue = new ConcurrentLinkedDeque<>();
|
||||||
private final ByteBufferPool _pool;
|
|
||||||
private final int _capacity;
|
private final int _capacity;
|
||||||
private final int _maxSize;
|
private final int _maxSize;
|
||||||
private final AtomicInteger _size;
|
private final AtomicInteger _size;
|
||||||
private long _lastUpdate = System.nanoTime();
|
private long _lastUpdate = System.nanoTime();
|
||||||
|
|
||||||
public Bucket(ByteBufferPool pool, int capacity, int maxSize)
|
public Bucket(int capacity, int maxSize)
|
||||||
{
|
{
|
||||||
_pool = pool;
|
|
||||||
_capacity = capacity;
|
_capacity = capacity;
|
||||||
_maxSize = maxSize;
|
_maxSize = maxSize;
|
||||||
_size = maxSize > 0 ? new AtomicInteger() : null;
|
_size = maxSize > 0 ? new AtomicInteger() : null;
|
||||||
|
@ -159,22 +157,6 @@ public interface ByteBufferPool
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param direct whether to create a direct buffer when none is available
|
|
||||||
* @return a ByteBuffer
|
|
||||||
* @deprecated use {@link #acquire()} instead
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public ByteBuffer acquire(boolean direct)
|
|
||||||
{
|
|
||||||
ByteBuffer buffer = queuePoll();
|
|
||||||
if (buffer == null)
|
|
||||||
return _pool.newByteBuffer(_capacity, direct);
|
|
||||||
if (_size != null)
|
|
||||||
_size.decrementAndGet();
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void release(ByteBuffer buffer)
|
public void release(ByteBuffer buffer)
|
||||||
{
|
{
|
||||||
_lastUpdate = System.nanoTime();
|
_lastUpdate = System.nanoTime();
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class MappedByteBufferPool extends AbstractByteBufferPool
|
||||||
|
|
||||||
private Bucket newBucket(int key)
|
private Bucket newBucket(int key)
|
||||||
{
|
{
|
||||||
return new Bucket(this, key * getCapacityFactor(), getMaxQueueLength());
|
return new Bucket(key * getCapacityFactor(), getMaxQueueLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue