org.apache.hadoop.hbase.io
Class BoundedByteBufferPool
java.lang.Object
org.apache.hadoop.hbase.io.BoundedByteBufferPool
@InterfaceAudience.Private
public class BoundedByteBufferPool
- extends Object
Like Hadoops' ByteBufferPool only you do not specify desired size when getting a ByteBuffer.
This pool keeps an upper bound on the count of ByteBuffers in the pool and on the maximum size
of ByteBuffer that it will retain (Hence the pool is 'bounded' as opposed to, say,
Hadoop's ElasticByteBuffferPool).
If a ByteBuffer is bigger than the configured threshold, we will just let the ByteBuffer go
rather than add it to the pool. If more ByteBuffers than the configured maximum instances,
we will not add the passed ByteBuffer to the pool; we will just drop it
(we will log a WARN in this case that we are at capacity).
The intended use case is a reservoir of bytebuffers that an RPC can reuse; buffers tend to
achieve a particular 'run' size over time give or take a few extremes. Set TRACE level on this
class for a couple of seconds to get reporting on how it is running when deployed.
This class is thread safe.
Constructor Summary |
BoundedByteBufferPool(int maxByteBufferSizeToCache,
int initialByteBufferSize,
int maxToCache)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BoundedByteBufferPool
public BoundedByteBufferPool(int maxByteBufferSizeToCache,
int initialByteBufferSize,
int maxToCache)
- Parameters:
maxByteBufferSizeToCache
- initialByteBufferSize
- maxToCache
-
getBuffer
public ByteBuffer getBuffer()
putBuffer
public void putBuffer(ByteBuffer bb)
Copyright © 2015 The Apache Software Foundation. All Rights Reserved.