Package org.xerial.snappy.buffer
Class CachedBufferAllocator
java.lang.Object
org.xerial.snappy.buffer.CachedBufferAllocator
- All Implemented Interfaces:
BufferAllocator
Cached buffer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Deque
<byte[]> private final int
private static BufferAllocatorFactory
private static final Map
<Integer, SoftReference<CachedBufferAllocator>> Use SoftReference so that having this queueTable does not prevent the GC of CachedBufferAllocator instances -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
allocate
(int size) static CachedBufferAllocator
getAllocator
(int bufferSize) static BufferAllocatorFactory
void
release
(byte[] buffer) static void
-
Field Details
-
factory
-
queueTable
Use SoftReference so that having this queueTable does not prevent the GC of CachedBufferAllocator instances -
bufferSize
private final int bufferSize -
bufferQueue
-
-
Constructor Details
-
CachedBufferAllocator
public CachedBufferAllocator(int bufferSize)
-
-
Method Details
-
setBufferAllocatorFactory
-
getBufferAllocatorFactory
-
getAllocator
-
allocate
public byte[] allocate(int size) - Specified by:
allocate
in interfaceBufferAllocator
-
release
public void release(byte[] buffer) - Specified by:
release
in interfaceBufferAllocator
-