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 buffers
      bufferSize - The buffer size to use
  • Method Details

    • getBufferSize

      public int getBufferSize()
      Specified by:
      getBufferSize in interface io.undertow.connector.ByteBufferPool
    • isDirect

      public boolean isDirect()
      Specified by:
      isDirect in interface io.undertow.connector.ByteBufferPool
    • allocate

      public io.undertow.connector.PooledByteBuffer allocate()
      Specified by:
      allocate in interface io.undertow.connector.ByteBufferPool
    • getArrayBackedPool

      public NotPoolingByteBufferPool getArrayBackedPool()
      Specified by:
      getArrayBackedPool in interface io.undertow.connector.ByteBufferPool
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface io.undertow.connector.ByteBufferPool
      Specified by:
      close in interface Closeable