T - the type of the record that can be emitted with this record writerpublic abstract class RecordWriter<T extends org.apache.flink.core.io.IOReadableWritable> extends Object implements AvailabilityProvider
The RecordWriter wraps the runtime's ResultPartitionWriter and takes care of channel
selection and serializing records into bytes.
AvailabilityProvider.AvailabilityHelper| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_OUTPUT_FLUSH_THREAD_NAME
Default name for the output flush thread, if no name with a task reference is given.
|
protected boolean |
flushAlways |
protected int |
numberOfChannels |
protected Random |
rng |
protected org.apache.flink.core.memory.DataOutputSerializer |
serializer |
protected ResultPartitionWriter |
targetPartition |
AVAILABLE| Modifier and Type | Method and Description |
|---|---|
abstract void |
broadcastEmit(T record)
This is used to broadcast streaming Watermarks in-band with records.
|
void |
broadcastEvent(AbstractEvent event) |
void |
broadcastEvent(AbstractEvent event,
boolean isPriorityEvent) |
protected void |
checkErroneous() |
void |
close()
Closes the writer.
|
abstract void |
emit(T record)
This is used to send regular records.
|
protected void |
emit(T record,
int targetSubpartition) |
void |
flushAll() |
CompletableFuture<?> |
getAvailableFuture() |
void |
randomEmit(T record)
This is used to send LatencyMarks to a random target channel.
|
static ByteBuffer |
serializeRecord(org.apache.flink.core.memory.DataOutputSerializer serializer,
org.apache.flink.core.io.IOReadableWritable record) |
void |
setMetricGroup(TaskIOMetricGroup metrics)
Sets the metric group for this RecordWriter.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitand, isApproximatelyAvailable, isAvailable, or@VisibleForTesting public static final String DEFAULT_OUTPUT_FLUSH_THREAD_NAME
protected final ResultPartitionWriter targetPartition
protected final int numberOfChannels
protected final org.apache.flink.core.memory.DataOutputSerializer serializer
protected final Random rng
protected final boolean flushAlways
protected void emit(T record, int targetSubpartition) throws IOException
IOExceptionpublic void broadcastEvent(AbstractEvent event) throws IOException
IOExceptionpublic void broadcastEvent(AbstractEvent event, boolean isPriorityEvent) throws IOException
IOException@VisibleForTesting public static ByteBuffer serializeRecord(org.apache.flink.core.memory.DataOutputSerializer serializer, org.apache.flink.core.io.IOReadableWritable record) throws IOException
IOExceptionpublic void flushAll()
public void setMetricGroup(TaskIOMetricGroup metrics)
public CompletableFuture<?> getAvailableFuture()
getAvailableFuture in interface AvailabilityProviderpublic abstract void emit(T record) throws IOException
IOExceptionpublic void randomEmit(T record) throws IOException
IOExceptionpublic abstract void broadcastEmit(T record) throws IOException
IOExceptionpublic void close()
protected void checkErroneous()
throws IOException
IOExceptionCopyright © 2014–2023 The Apache Software Foundation. All rights reserved.