T - the type of the record that can be emitted with this record writerpublic class RecordWriter<T extends org.apache.flink.core.io.IOReadableWritable> extends Object
The RecordWriter wraps the runtime's ResultPartitionWriter and takes care of
serializing records into buffers.
Important: it is necessary to call flushAll() 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) |
RecordWriter(ResultPartitionWriter writer,
ChannelSelector<T> channelSelector,
boolean flushAlways) |
| 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 |
flushAll() |
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 RecordWriter(ResultPartitionWriter writer, ChannelSelector<T> channelSelector, boolean flushAlways)
public void emit(T record) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void broadcastEmit(T record) throws IOException, InterruptedException
ChannelSelector.IOExceptionInterruptedExceptionpublic void randomEmit(T record) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void broadcastEvent(AbstractEvent event) throws IOException
IOExceptionpublic void flushAll()
public void clearBuffers()
public void setMetricGroup(TaskIOMetricGroup metrics)
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.