Package org.apache.nifi.io.nio
Class BufferPool
java.lang.Object
org.apache.nifi.io.nio.BufferPool
- All Implemented Interfaces:
Runnable
-
Field Summary
Modifier and TypeFieldDescription(package private) final BlockingQueue
<ByteBuffer> (package private) double
private Calendar
private long
private static final org.slf4j.Logger
(package private) final double
private static final double
(package private) double
private final Calendar
private long
-
Constructor Summary
ConstructorDescriptionBufferPool
(int bufferCount, int bufferCapacity, boolean allocateDirect, double maxRateMBps) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
static List
<ByteBuffer> createBuffers
(int bufferCount, int bufferCapacity, boolean allocateDirect) private void
poll()
boolean
returnBuffer
(ByteBuffer buffer, int bytesProcessed) Returns the given buffer to the pool - and clears it.void
run()
int
size()
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
bufferPool
-
ONE_MB
private static final double ONE_MB- See Also:
-
lastRateSampleTime
-
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
Returns the given buffer to the pool - and clears it.- Parameters:
buffer
- buffer to returnbytesProcessed
- bytes processed for this buffer being returned- Returns:
- true if buffer returned to pool
-
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()
-