Class BufferPool

java.lang.Object
org.apache.nifi.io.nio.BufferPool
All Implemented Interfaces:
Runnable

public class BufferPool extends Object implements Runnable
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • bufferPool

      final BlockingQueue<ByteBuffer> bufferPool
    • ONE_MB

      private static final double ONE_MB
      See Also:
    • lastRateSampleTime

      private Calendar lastRateSampleTime
    • startTime

      private final Calendar startTime
    • lastRateSampleMBps

      double lastRateSampleMBps
    • overallMBps

      double overallMBps
    • totalBytesExtracted

      private long totalBytesExtracted
    • lastTotalBytesExtracted

      private long lastTotalBytesExtracted
    • maxRateMBps

      final double maxRateMBps
  • Constructor Details

    • BufferPool

      public BufferPool(int bufferCount, int bufferCapacity, boolean allocateDirect, double maxRateMBps)
  • Method Details

    • returnBuffer

      public boolean returnBuffer(ByteBuffer buffer, int bytesProcessed)
      Returns the given buffer to the pool - and clears it.
      Parameters:
      buffer - buffer to return
      bytesProcessed - bytes processed for this buffer being returned
      Returns:
      true if buffer returned to pool
    • poll

      public ByteBuffer poll()
    • size

      public int size()
    • computeRate

      private void computeRate()
    • createBuffers

      public static List<ByteBuffer> createBuffers(int bufferCount, int bufferCapacity, boolean allocateDirect)
    • logChannelReadRates

      private void logChannelReadRates()
    • run

      public void run()
      Specified by:
      run in interface Runnable