public class ReferenceCountingAllocator<T extends reactor.core.support.Recyclable> extends java.lang.Object implements Allocator<T>
Allocator that uses reference counting to determine when an object
should
be recycled and placed back into the pool to be reused.| Constructor and Description |
|---|
ReferenceCountingAllocator(int initialSize,
reactor.fn.Supplier<T> factory) |
ReferenceCountingAllocator(reactor.fn.Supplier<T> factory) |
| Modifier and Type | Method and Description |
|---|---|
Reference<T> |
allocate()
Allocate an object from the internal pool.
|
java.util.List<Reference<T>> |
allocateBatch(int size)
Allocate a batch of objects all at once.
|
void |
release(java.util.List<Reference<T>> batch)
Efficiently release a batch of References all at once.
|
public ReferenceCountingAllocator(reactor.fn.Supplier<T> factory)
public ReferenceCountingAllocator(int initialSize,
reactor.fn.Supplier<T> factory)
public Reference<T> allocate()
Allocatorpublic java.util.List<Reference<T>> allocateBatch(int size)
AllocatorallocateBatch in interface Allocator<T extends reactor.core.support.Recyclable>size - the number of objects to allocateList of References to the allocated objects