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
subpartition 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 |
numberOfSubpartitions |
protected Random |
rng |
protected org.apache.flink.core.memory.DataOutputSerializer |
serializer |
protected ResultPartitionWriter |
targetPartition |
AVAILABLE| Modifier and Type | Method and Description |
|---|---|
void |
abortCheckpoint(long checkpointId,
CheckpointException cause) |
void |
alignedBarrierTimeout(long checkpointId) |
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.
|
protected void |
emit(ByteBuffer record,
int targetSubpartition) |
abstract void |
emit(T record)
This is used to send regular records.
|
void |
emit(T record,
int targetSubpartition) |
void |
flushAll() |
CompletableFuture<?> |
getAvailableFuture() |
int |
getNumberOfSubpartitions() |
boolean |
isSubpartitionDerivable()
Whether the subpartition where an element comes from can be derived from the existing
information.
|
void |
randomEmit(T record)
This is used to send LatencyMarks to a random target subpartition.
|
static ByteBuffer |
serializeRecord(org.apache.flink.core.memory.DataOutputSerializer serializer,
org.apache.flink.core.io.IOReadableWritable record) |
void |
setMaxOverdraftBuffersPerGate(int maxOverdraftBuffersPerGate)
Sets the max overdraft buffer size of per gate.
|
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 numberOfSubpartitions
protected final org.apache.flink.core.memory.DataOutputSerializer serializer
protected final Random rng
protected final boolean flushAlways
public void emit(T record, int targetSubpartition) throws IOException
IOExceptionprotected void emit(ByteBuffer record, int targetSubpartition) throws IOException
IOExceptionpublic void broadcastEvent(AbstractEvent event) throws IOException
IOExceptionpublic void broadcastEvent(AbstractEvent event, boolean isPriorityEvent) throws IOException
IOExceptionpublic void alignedBarrierTimeout(long checkpointId)
throws IOException
IOExceptionpublic void abortCheckpoint(long checkpointId,
CheckpointException cause)
@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 int getNumberOfSubpartitions()
public boolean isSubpartitionDerivable()
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
IOExceptionpublic void setMaxOverdraftBuffersPerGate(int maxOverdraftBuffersPerGate)
Copyright © 2014–2025 The Apache Software Foundation. All rights reserved.