@InterfaceAudience.Private public class ChunkCreator extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ChunkCreator.ChunkType
Types of chunks, based on their sizes
|
private class |
ChunkCreator.MemStoreChunkPool
A pool of
Chunk instances. |
Modifier and Type | Field and Description |
---|---|
private AtomicInteger |
chunkID |
private Map<Integer,Chunk> |
chunkIdMap |
(package private) static boolean |
chunkPoolDisabled |
private int |
chunkSize |
private ChunkCreator.MemStoreChunkPool |
dataChunksPool |
private int |
indexChunkSize |
private ChunkCreator.MemStoreChunkPool |
indexChunksPool |
(package private) static ChunkCreator |
instance |
private static org.slf4j.Logger |
LOG |
private boolean |
offheap |
static int |
SIZEOF_CHUNK_HEADER |
Constructor and Description |
---|
ChunkCreator(int chunkSize,
boolean offheap,
long globalMemStoreSize,
float poolSizePercentage,
float initialCountPercentage,
HeapMemoryManager heapMemoryManager,
float indexChunkSizePercentage) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
clearChunkIds() |
(package private) void |
clearChunksInPool() |
(package private) static void |
clearDisableFlag() |
private Chunk |
createChunk(boolean pool,
ChunkCreator.ChunkType chunkType,
int size)
Creates the chunk either onheap or offheap
|
private Chunk |
createChunkForPool(ChunkCreator.ChunkType chunkType,
int chunkSize) |
(package private) Chunk |
getChunk()
Creates and inits a data chunk.
|
(package private) Chunk |
getChunk(ChunkCreator.ChunkType chunkType)
Creates and inits a chunk with specific type.
|
(package private) Chunk |
getChunk(ChunkCreator.ChunkType chunkType,
int size)
Creates and inits a chunk.
|
(package private) Chunk |
getChunk(int id) |
(package private) int |
getChunkSize() |
(package private) int |
getChunkSize(ChunkCreator.ChunkType chunkType) |
(package private) ChunkCreator.MemStoreChunkPool |
getDataChunksPool() |
(package private) ChunkCreator.MemStoreChunkPool |
getIndexChunksPool() |
static ChunkCreator |
getInstance() |
(package private) Chunk |
getJumboChunk(int jumboSize)
Creates and inits a chunk of a special size, bigger than a regular chunk size.
|
(package private) int |
getMaxCount() |
(package private) int |
getMaxCount(ChunkCreator.ChunkType chunkType) |
(package private) int |
getPoolSize() |
(package private) int |
getPoolSize(ChunkCreator.ChunkType chunkType) |
static ChunkCreator |
initialize(int chunkSize,
boolean offheap,
long globalMemStoreSize,
float poolSizePercentage,
float initialCountPercentage,
HeapMemoryManager heapMemoryManager,
float indexChunkSizePercent)
Initializes the instance of ChunkCreator
|
private ChunkCreator.MemStoreChunkPool |
initializePool(String label,
long globalMemStoreSize,
float poolSizePercentage,
float initialCountPercentage,
int chunkSize,
ChunkCreator.ChunkType chunkType,
HeapMemoryManager heapMemoryManager) |
private void |
initializePools(int chunkSize,
long globalMemStoreSize,
float poolSizePercentage,
float indexChunkSizePercentage,
float initialCountPercentage,
HeapMemoryManager heapMemoryManager) |
(package private) boolean |
isChunkInPool(int chunkId) |
(package private) boolean |
isOffheap() |
(package private) int |
numberOfMappedChunks() |
(package private) void |
putbackChunks(Set<Integer> chunks) |
(package private) Chunk |
removeChunk(int chunkId) |
private void |
removeChunks(Set<Integer> chunkIDs) |
private static final org.slf4j.Logger LOG
private AtomicInteger chunkID
public static final int SIZEOF_CHUNK_HEADER
private Map<Integer,Chunk> chunkIdMap
private final boolean offheap
static ChunkCreator instance
static boolean chunkPoolDisabled
private ChunkCreator.MemStoreChunkPool dataChunksPool
private final int chunkSize
private int indexChunkSize
private ChunkCreator.MemStoreChunkPool indexChunksPool
ChunkCreator(int chunkSize, boolean offheap, long globalMemStoreSize, float poolSizePercentage, float initialCountPercentage, HeapMemoryManager heapMemoryManager, float indexChunkSizePercentage)
private void initializePools(int chunkSize, long globalMemStoreSize, float poolSizePercentage, float indexChunkSizePercentage, float initialCountPercentage, HeapMemoryManager heapMemoryManager)
public static ChunkCreator initialize(int chunkSize, boolean offheap, long globalMemStoreSize, float poolSizePercentage, float initialCountPercentage, HeapMemoryManager heapMemoryManager, float indexChunkSizePercent)
chunkSize
- the chunkSizeoffheap
- indicates if the chunk is to be created offheap or notglobalMemStoreSize
- the global memstore sizepoolSizePercentage
- pool size percentageinitialCountPercentage
- the initial count of the chunk pool if anyheapMemoryManager
- the heapmemory managerpublic static ChunkCreator getInstance()
Chunk getChunk()
Chunk getChunk(ChunkCreator.ChunkType chunkType)
Chunk getChunk(ChunkCreator.ChunkType chunkType, int size)
size
- the size of the chunk to be allocated, in bytesChunk getJumboChunk(int jumboSize)
jumboSize
- the special size to be usedprivate Chunk createChunk(boolean pool, ChunkCreator.ChunkType chunkType, int size)
pool
- indicates if the chunks have to be created which will be used by the PoolchunkType
- whether the requested chunk is data chunk or index chunk.size
- the size of the chunk to be allocated, in bytesprivate Chunk createChunkForPool(ChunkCreator.ChunkType chunkType, int chunkSize)
boolean isOffheap()
private void removeChunks(Set<Integer> chunkIDs)
Chunk removeChunk(int chunkId)
int numberOfMappedChunks()
void clearChunkIds()
static void clearDisableFlag()
private ChunkCreator.MemStoreChunkPool initializePool(String label, long globalMemStoreSize, float poolSizePercentage, float initialCountPercentage, int chunkSize, ChunkCreator.ChunkType chunkType, HeapMemoryManager heapMemoryManager)
int getMaxCount()
int getMaxCount(ChunkCreator.ChunkType chunkType)
int getPoolSize()
int getPoolSize(ChunkCreator.ChunkType chunkType)
boolean isChunkInPool(int chunkId)
void clearChunksInPool()
int getChunkSize()
int getChunkSize(ChunkCreator.ChunkType chunkType)
void putbackChunks(Set<Integer> chunks)
ChunkCreator.MemStoreChunkPool getIndexChunksPool()
ChunkCreator.MemStoreChunkPool getDataChunksPool()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.