Class LockFreeBufferPool
java.lang.Object
express.mvp.roray.ffm.pool.LockFreeBufferPool
- All Implemented Interfaces:
AutoCloseable
Lock-free buffer pool using a ring buffer for index tracking.
This pool provides high-performance buffer acquisition without locks, using a ring buffer to track free buffer indices.
-
Constructor Summary
ConstructorsConstructorDescriptionLockFreeBufferPool(int count, int bufferSize) Creates a new lock-free buffer pool. -
Method Summary
-
Constructor Details
-
LockFreeBufferPool
public LockFreeBufferPool(int count, int bufferSize) Creates a new lock-free buffer pool.- Parameters:
count- number of buffers (must be a power of 2)bufferSize- size of each buffer in bytes
-
-
Method Details
-
acquire
Acquires a buffer reference from the pool.- Returns:
- a BufferRef with refCount=1, or
nullif the pool is empty
-
capacity
public int capacity() -
available
public int available() -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-