T
- the type of the record that can be emitted with this record writerpublic abstract class RecordWriter<T extends 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 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(DataOutputSerializer serializer,
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, wait
and, isApproximatelyAvailable, isAvailable, or
@VisibleForTesting public static final String DEFAULT_OUTPUT_FLUSH_THREAD_NAME
protected final ResultPartitionWriter targetPartition
protected final int numberOfSubpartitions
protected final DataOutputSerializer serializer
protected final Random rng
protected final boolean flushAlways
public void emit(T record, int targetSubpartition) throws IOException
IOException
protected void emit(ByteBuffer record, int targetSubpartition) throws IOException
IOException
public void broadcastEvent(AbstractEvent event) throws IOException
IOException
public void broadcastEvent(AbstractEvent event, boolean isPriorityEvent) throws IOException
IOException
public void alignedBarrierTimeout(long checkpointId) throws IOException
IOException
public void abortCheckpoint(long checkpointId, CheckpointException cause)
@VisibleForTesting public static ByteBuffer serializeRecord(DataOutputSerializer serializer, IOReadableWritable record) throws IOException
IOException
public void flushAll()
public void setMetricGroup(TaskIOMetricGroup metrics)
public int getNumberOfSubpartitions()
public boolean isSubpartitionDerivable()
public CompletableFuture<?> getAvailableFuture()
getAvailableFuture
in interface AvailabilityProvider
public abstract void emit(T record) throws IOException
IOException
public void randomEmit(T record) throws IOException
IOException
public abstract void broadcastEmit(T record) throws IOException
IOException
public void close()
protected void checkErroneous() throws IOException
IOException
public void setMaxOverdraftBuffersPerGate(int maxOverdraftBuffersPerGate)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.