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 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).
Constructor and Description |
---|
RecordWriter(ResultPartitionWriter writer) |
RecordWriter(ResultPartitionWriter writer,
ChannelSelector<T> channelSelector,
long timeout,
String taskName) |
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 |
close()
Closes the writer.
|
static RecordWriter |
createRecordWriter(ResultPartitionWriter writer,
ChannelSelector channelSelector,
long timeout,
String taskName) |
static RecordWriter |
createRecordWriter(ResultPartitionWriter writer,
ChannelSelector channelSelector,
String taskName) |
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.
|
public RecordWriter(ResultPartitionWriter writer)
public RecordWriter(ResultPartitionWriter writer, ChannelSelector<T> channelSelector, long timeout, String taskName)
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
IOException
public void flushAll()
public void clearBuffers()
public void setMetricGroup(TaskIOMetricGroup metrics)
public void close()
public static RecordWriter createRecordWriter(ResultPartitionWriter writer, ChannelSelector channelSelector, long timeout, String taskName)
public static RecordWriter createRecordWriter(ResultPartitionWriter writer, ChannelSelector channelSelector, String taskName)
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.