public final class RecyclingIntBlockAllocator extends IntBlockPool.Allocator
IntBlockPool.Allocator implementation that recycles unused int
blocks in a buffer and reuses them in subsequent calls to
getIntBlock().
Note: This class is not thread-safe
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFERED_BLOCKS |
blockSize| Constructor and Description |
|---|
RecyclingIntBlockAllocator()
Creates a new
RecyclingIntBlockAllocator with a block size of
IntBlockPool.INT_BLOCK_SIZE, upper buffered docs limit of
DEFAULT_BUFFERED_BLOCKS (64). |
RecyclingIntBlockAllocator(int blockSize,
int maxBufferedBlocks)
Creates a new
RecyclingIntBlockAllocator. |
RecyclingIntBlockAllocator(int blockSize,
int maxBufferedBlocks,
Counter bytesUsed)
Creates a new
RecyclingIntBlockAllocator |
| Modifier and Type | Method and Description |
|---|---|
long |
bytesUsed() |
int |
freeBlocks(int num)
Removes the given number of int blocks from the buffer if possible.
|
int[] |
getIntBlock() |
int |
maxBufferedBlocks() |
int |
numBufferedBlocks() |
void |
recycleIntBlocks(int[][] blocks,
int start,
int end) |
public static final int DEFAULT_BUFFERED_BLOCKS
public RecyclingIntBlockAllocator(int blockSize,
int maxBufferedBlocks,
Counter bytesUsed)
RecyclingIntBlockAllocatorblockSize - the block size in bytesmaxBufferedBlocks - maximum number of buffered int blockbytesUsed - Counter reference counting internally allocated bytespublic RecyclingIntBlockAllocator(int blockSize,
int maxBufferedBlocks)
RecyclingIntBlockAllocator.blockSize - the size of each block returned by this allocatormaxBufferedBlocks - maximum number of buffered int blockspublic RecyclingIntBlockAllocator()
RecyclingIntBlockAllocator with a block size of
IntBlockPool.INT_BLOCK_SIZE, upper buffered docs limit of
DEFAULT_BUFFERED_BLOCKS (64).public int[] getIntBlock()
getIntBlock in class IntBlockPool.Allocatorpublic void recycleIntBlocks(int[][] blocks,
int start,
int end)
recycleIntBlocks in class IntBlockPool.Allocatorpublic int numBufferedBlocks()
public long bytesUsed()
IntBlockPool.Allocatorpublic int maxBufferedBlocks()
public int freeBlocks(int num)
num - the number of int blocks to removeCopyright © 2000-2018 Apache Software Foundation. All Rights Reserved.