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 intprivate static BufferAllocatorFactoryprivate 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 CachedBufferAllocatorgetAllocator(int bufferSize) static BufferAllocatorFactoryvoidrelease(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:
allocatein interfaceBufferAllocator
-
release
public void release(byte[] buffer) - Specified by:
releasein interfaceBufferAllocator
-