BlockAllocatorProvider offering a thread-safe free block list
for each block size.
This implementation is thread-safe.
| Modifier and Type | Class and Description |
|---|---|
| private static class | PooledBlockAllocatorProvider.
A |
| Modifier and Type | Field and Description |
|---|---|
| private final ConcurrentMap | |
| private static final PooledBlockAllocatorProvider |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static PooledBlockAllocatorProvider | |
| public BlockAllocator | vendAllocator(final int blockSize)
Implements abstract com. Returns a |
| allocators | back to summary |
|---|---|
| private final ConcurrentMap<Integer, BlockAllocator> allocators | |
| INSTANCE | back to summary |
|---|---|
| private static final PooledBlockAllocatorProvider INSTANCE | |
| PooledBlockAllocatorProvider | back to summary |
|---|---|
| private PooledBlockAllocatorProvider() | |
| getInstance | back to summary |
|---|---|
| public static PooledBlockAllocatorProvider getInstance() | |
| vendAllocator | back to summary |
|---|---|
| public BlockAllocator vendAllocator(final int blockSize) Implements abstract com. Doc from com. Returns a
| |
BlockAllocator of for a particular size that has a single thread-safe free list.
This implementation is thread-safe.
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| private final int | |
| pack-priv static final int | |
| private final ConcurrentLinkedQueue | |
| private final AtomicInteger |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Block | allocateBlock()
Implements abstract com. Allocates a |
| public void | close()
Implements abstract com. Implements java. Releases the allocator back to the |
| public int | getBlockSize()
Implements abstract com. Returns the fixed block size of the allocator. |
| blockLimit | back to summary |
|---|---|
| private final int blockLimit | |
| blockSize | back to summary |
|---|---|
| private final int blockSize | |
| FREE_CAPACITY | back to summary |
|---|---|
| pack-priv static final int FREE_CAPACITY | |
| freeBlocks | back to summary |
|---|---|
| private final ConcurrentLinkedQueue<Block> freeBlocks | |
| size | back to summary |
|---|---|
| private final AtomicInteger size | |
| PooledBlockAllocator | back to summary |
|---|---|
| public PooledBlockAllocator(final int blockSize) | |
| allocateBlock | back to summary |
|---|---|
| public Block allocateBlock() Implements abstract com. Doc from com. Allocates a
| |
| close | back to summary |
|---|---|
| public void close() Implements abstract com. Implements java. Doc from com. Releases the allocator back to the
| |
| getBlockSize | back to summary |
|---|---|
| public int getBlockSize() Implements abstract com. Doc from com. Returns the fixed block size of the allocator.
| |