T
- the type of the record that can be emitted with this record writerpublic final class ChannelSelectorRecordWriter<T extends IOReadableWritable> extends RecordWriter<T>
The ChannelSelectorRecordWriter extends the RecordWriter
and maintains an array of
BufferBuilder
s for all the channels. The emit(IOReadableWritable)
operation is based on ChannelSelector
to select the target channel.
AvailabilityProvider.AvailabilityHelper
DEFAULT_OUTPUT_FLUSH_THREAD_NAME, numberOfChannels, rng, serializer, targetPartition
AVAILABLE
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
BufferBuilder s 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, setMetricGroup
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isApproximatelyAvailable, isAvailable
public void emit(T record) throws IOException, InterruptedException
RecordWriter
emit
in class RecordWriter<T extends IOReadableWritable>
IOException
InterruptedException
public void randomEmit(T record) throws IOException, InterruptedException
RecordWriter
randomEmit
in class RecordWriter<T extends IOReadableWritable>
IOException
InterruptedException
public void broadcastEmit(T record) throws IOException, InterruptedException
broadcastEmit
in class RecordWriter<T extends IOReadableWritable>
IOException
InterruptedException
public BufferBuilder getBufferBuilder(int targetChannel) throws IOException, InterruptedException
RecordWriter
BufferBuilder
may already exist if not filled up last time, otherwise we need
request a new one for this target channel.IOException
InterruptedException
public BufferBuilder requestNewBufferBuilder(int targetChannel) throws IOException, InterruptedException
RecordWriter
BufferBuilder
for the target channel and returns it.IOException
InterruptedException
public void tryFinishCurrentBufferBuilder(int targetChannel)
RecordWriter
BufferBuilder
as finished if present and clears the state for next one.public void emptyCurrentBufferBuilder(int targetChannel)
RecordWriter
BufferBuilder
as empty for the target channel.public void closeBufferBuilder(int targetChannel)
RecordWriter
BufferBuilder
as finished and releases the resources for the target channel.public void clearBuffers()
RecordWriter
BufferBuilder
s for all the channels.clearBuffers
in class RecordWriter<T extends IOReadableWritable>
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.