T - the type of the record that can be emitted with this record writerpublic final class ChannelSelectorRecordWriter<T extends org.apache.flink.core.io.IOReadableWritable> extends RecordWriter<T>
The ChannelSelectorRecordWriter extends the RecordWriter and maintains an array of
BufferBuilders for all the channels. The emit(IOReadableWritable)
operation is based on ChannelSelector to select the target channel.
AvailabilityProvider.AvailabilityHelperDEFAULT_OUTPUT_FLUSH_THREAD_NAME, numberOfChannels, rng, serializer, targetPartitionAVAILABLE| Modifier and Type | Method and Description |
|---|---|
void |
broadcastEmit(T record)
The record is serialized into intermediate serialization buffer which is then copied
into the target buffer for every channel.
|
void |
clearBuffers()
Closes the
BufferBuilders for all the channels. |
void |
closeBufferBuilder(int targetChannel)
Marks the current
BufferBuilder as finished and releases the resources for the target channel. |
void |
emit(T record)
This is used to send regular records.
|
void |
emptyCurrentBufferBuilder(int targetChannel)
Marks the current
BufferBuilder as empty for the target channel. |
BufferBuilder |
getBufferBuilder(int targetChannel)
The
BufferBuilder may already exist if not filled up last time, otherwise we need
request a new one for this target channel. |
void |
randomEmit(T record)
This is used to send LatencyMarks to a random target channel.
|
BufferBuilder |
requestNewBufferBuilder(int targetChannel)
Requests a new
BufferBuilder for the target channel and returns it. |
void |
tryFinishCurrentBufferBuilder(int targetChannel)
Marks the current
BufferBuilder as finished if present and clears the state for next one. |
broadcastEvent, checkErroneous, close, copyFromSerializerToTargetChannel, emit, finishBufferBuilder, flushAll, flushTargetPartition, getAvailableFuture, setMetricGroupclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisApproximatelyAvailable, isAvailablepublic void emit(T record) throws IOException, InterruptedException
RecordWriteremit in class RecordWriter<T extends org.apache.flink.core.io.IOReadableWritable>IOExceptionInterruptedExceptionpublic void randomEmit(T record) throws IOException, InterruptedException
RecordWriterrandomEmit in class RecordWriter<T extends org.apache.flink.core.io.IOReadableWritable>IOExceptionInterruptedExceptionpublic void broadcastEmit(T record) throws IOException, InterruptedException
broadcastEmit in class RecordWriter<T extends org.apache.flink.core.io.IOReadableWritable>IOExceptionInterruptedExceptionpublic BufferBuilder getBufferBuilder(int targetChannel) throws IOException, InterruptedException
RecordWriterBufferBuilder may already exist if not filled up last time, otherwise we need
request a new one for this target channel.IOExceptionInterruptedExceptionpublic BufferBuilder requestNewBufferBuilder(int targetChannel) throws IOException, InterruptedException
RecordWriterBufferBuilder for the target channel and returns it.IOExceptionInterruptedExceptionpublic void tryFinishCurrentBufferBuilder(int targetChannel)
RecordWriterBufferBuilder as finished if present and clears the state for next one.public void emptyCurrentBufferBuilder(int targetChannel)
RecordWriterBufferBuilder as empty for the target channel.public void closeBufferBuilder(int targetChannel)
RecordWriterBufferBuilder as finished and releases the resources for the target channel.public void clearBuffers()
RecordWriterBufferBuilders for all the channels.clearBuffers in class RecordWriter<T extends org.apache.flink.core.io.IOReadableWritable>Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.