T
- the type of the record that can be emitted with this record writerpublic class RecordWriter<T extends IOReadableWritable> extends Object
The RecordWriter wraps the runtime's ResultPartitionWriter
and takes care of
serializing records into buffers.
Important: it is necessary to call flush()
after
all records have been written with emit(IOReadableWritable)
. This
ensures that all produced records are written to the output stream (incl.
partially filled ones).
Modifier and Type | Field and Description |
---|---|
protected ResultPartitionWriter |
targetPartition |
Constructor and Description |
---|
RecordWriter(ResultPartitionWriter writer) |
RecordWriter(ResultPartitionWriter writer,
ChannelSelector<T> channelSelector) |
Modifier and Type | Method and Description |
---|---|
void |
broadcastEmit(T record)
This is used to broadcast Streaming Watermarks in-band with records.
|
void |
broadcastEvent(AbstractEvent event) |
void |
clearBuffers() |
void |
emit(T record) |
void |
flush() |
void |
randomEmit(T record)
This is used to send LatencyMarks to a random target channel
|
void |
setMetricGroup(TaskIOMetricGroup metrics)
Sets the metric group for this RecordWriter.
|
protected final ResultPartitionWriter targetPartition
public RecordWriter(ResultPartitionWriter writer)
public RecordWriter(ResultPartitionWriter writer, ChannelSelector<T> channelSelector)
public void emit(T record) throws IOException, InterruptedException
IOException
InterruptedException
public void broadcastEmit(T record) throws IOException, InterruptedException
ChannelSelector
.IOException
InterruptedException
public void randomEmit(T record) throws IOException, InterruptedException
IOException
InterruptedException
public void broadcastEvent(AbstractEvent event) throws IOException, InterruptedException
IOException
InterruptedException
public void flush() throws IOException
IOException
public void clearBuffers()
public void setMetricGroup(TaskIOMetricGroup metrics)
metrics
- Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.