use of org.apache.flink.runtime.io.network.buffer.BufferBuilder in project flink by splunk.
the class BufferWritingResultPartition method finishUnicastBufferBuilder.
private void finishUnicastBufferBuilder(int targetSubpartition) {
final BufferBuilder bufferBuilder = unicastBufferBuilders[targetSubpartition];
if (bufferBuilder != null) {
int bytes = bufferBuilder.finish();
numBytesProduced.inc(bytes);
numBytesOut.inc(bytes);
numBuffersOut.inc();
unicastBufferBuilders[targetSubpartition] = null;
bufferBuilder.close();
}
}
use of org.apache.flink.runtime.io.network.buffer.BufferBuilder in project flink by splunk.
the class BufferWritingResultPartition method broadcastRecord.
@Override
public void broadcastRecord(ByteBuffer record) throws IOException {
totalWrittenBytes += ((long) record.remaining() * numSubpartitions);
BufferBuilder buffer = appendBroadcastDataForNewRecord(record);
while (record.hasRemaining()) {
// full buffer, partial record
finishBroadcastBufferBuilder();
buffer = appendBroadcastDataForRecordContinuation(record);
}
if (buffer.isFull()) {
// full buffer, full record
finishBroadcastBufferBuilder();
}
// partial buffer, full record
}
use of org.apache.flink.runtime.io.network.buffer.BufferBuilder in project flink by splunk.
the class BufferWritingResultPartition method appendBroadcastDataForNewRecord.
private BufferBuilder appendBroadcastDataForNewRecord(final ByteBuffer record) throws IOException {
BufferBuilder buffer = broadcastBufferBuilder;
if (buffer == null) {
buffer = requestNewBroadcastBufferBuilder();
createBroadcastBufferConsumers(buffer, 0, record.remaining());
}
buffer.appendAndCommit(record);
return buffer;
}
use of org.apache.flink.runtime.io.network.buffer.BufferBuilder in project flink by splunk.
the class BufferWritingResultPartition method requestNewUnicastBufferBuilder.
private BufferBuilder requestNewUnicastBufferBuilder(int targetSubpartition) throws IOException {
checkInProduceState();
ensureUnicastMode();
final BufferBuilder bufferBuilder = requestNewBufferBuilderFromPool(targetSubpartition);
unicastBufferBuilders[targetSubpartition] = bufferBuilder;
return bufferBuilder;
}
use of org.apache.flink.runtime.io.network.buffer.BufferBuilder in project flink by splunk.
the class BufferWritingResultPartition method emitRecord.
@Override
public void emitRecord(ByteBuffer record, int targetSubpartition) throws IOException {
totalWrittenBytes += record.remaining();
BufferBuilder buffer = appendUnicastDataForNewRecord(record, targetSubpartition);
while (record.hasRemaining()) {
// full buffer, partial record
finishUnicastBufferBuilder(targetSubpartition);
buffer = appendUnicastDataForRecordContinuation(record, targetSubpartition);
}
if (buffer.isFull()) {
// full buffer, full record
finishUnicastBufferBuilder(targetSubpartition);
}
// partial buffer, full record
}
Aggregations