Class ChunkCreator.MemStoreChunkPool
java.lang.Object
org.apache.hadoop.hbase.regionserver.ChunkCreator.MemStoreChunkPool
- All Implemented Interfaces:
- HeapMemoryManager.HeapMemoryTuneObserver
- Enclosing class:
- ChunkCreator
private class ChunkCreator.MemStoreChunkPool
extends Object
implements HeapMemoryManager.HeapMemoryTuneObserver
A pool of 
Chunk instances. MemStoreChunkPool caches a number of retired chunks for
 reusing, it could decrease allocating bytes when writing, thereby optimizing the garbage
 collection on JVM.- 
Nested Class SummaryNested Classes
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate final AtomicLongprivate final intprivate final ChunkCreator.ChunkTypeprivate final Stringprivate intprivate final floatprivate final BlockingQueue<Chunk>private final LongAdderprivate final ScheduledExecutorServiceStatistics thread schedule poolprivate static final intStatistics thread
- 
Constructor SummaryConstructorsConstructorDescriptionMemStoreChunkPool(String label, int chunkSize, ChunkCreator.ChunkType chunkType, int maxCount, int initialCount, float poolSizePercentage) 
- 
Method SummaryModifier and TypeMethodDescription(package private) ChunkgetChunk()Poll a chunk from the pool, reset it if not null, else create a new chunk to return if we have not yet created max allowed chunks count.(package private) intprivate intvoidonHeapMemoryTune(long newMemstoreSize, long newBlockCacheSize) This method would be called by HeapMemoryManger when a heap memory tune action took place.private voidAdd the chunks to the pool, when the pool achieves the max size, it will skip the remaining chunks
- 
Field Details- 
chunkSize
- 
chunkType
- 
maxCount
- 
reclaimedChunks
- 
poolSizePercentage
- 
scheduleThreadPoolStatistics thread schedule pool
- 
statThreadPeriodStatistics thread- See Also:
 
- 
chunkCount
- 
reusedChunkCount
- 
label
 
- 
- 
Constructor Details- 
MemStoreChunkPoolMemStoreChunkPool(String label, int chunkSize, ChunkCreator.ChunkType chunkType, int maxCount, int initialCount, float poolSizePercentage) 
 
- 
- 
Method Details- 
getChunkPoll a chunk from the pool, reset it if not null, else create a new chunk to return if we have not yet created max allowed chunks count. When we have already created max allowed chunks and no free chunks as of now, return null. It is the responsibility of the caller to make a chunk then. Note: Chunks returned by this pool must be put back to the pool after its use.- Returns:
- a chunk
- See Also:
 
- 
getChunkSizeint getChunkSize()
- 
putbackChunksAdd the chunks to the pool, when the pool achieves the max size, it will skip the remaining chunks
- 
getMaxCount
- 
onHeapMemoryTuneDescription copied from interface:HeapMemoryManager.HeapMemoryTuneObserverThis method would be called by HeapMemoryManger when a heap memory tune action took place.- Specified by:
- onHeapMemoryTunein interface- HeapMemoryManager.HeapMemoryTuneObserver
- Parameters:
- newMemstoreSize- The newly calculated global memstore size
- newBlockCacheSize- The newly calculated global blockcache size
 
 
-