Package org.restheart.buffers
Class NotPoolingByteBufferPool
java.lang.Object
org.restheart.buffers.NotPoolingByteBufferPool
- All Implemented Interfaces:
io.undertow.connector.ByteBufferPool,Closeable,AutoCloseable
public class NotPoolingByteBufferPool
extends Object
implements io.undertow.connector.ByteBufferPool
A byte buffer pool implementation that does not actually pool resources.
This is intended for use with Virtual Threads, where resource pooling is unnecessary and may even be disadvantageous due to potential overhead.
- Author:
- Andrea Di Cesare
-
Constructor Details
-
NotPoolingByteBufferPool
public NotPoolingByteBufferPool(boolean direct, int bufferSize) - Parameters:
direct- If this implementation should use direct buffersbufferSize- The buffer size to use
-
-
Method Details
-
getBufferSize
public int getBufferSize()- Specified by:
getBufferSizein interfaceio.undertow.connector.ByteBufferPool
-
isDirect
public boolean isDirect()- Specified by:
isDirectin interfaceio.undertow.connector.ByteBufferPool
-
allocate
public io.undertow.connector.PooledByteBuffer allocate()- Specified by:
allocatein interfaceio.undertow.connector.ByteBufferPool
-
getArrayBackedPool
- Specified by:
getArrayBackedPoolin interfaceio.undertow.connector.ByteBufferPool
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceio.undertow.connector.ByteBufferPool- Specified by:
closein interfaceCloseable
-