Class MultipleRecordWriters<T extends org.apache.flink.core.io.IOReadableWritable>

java.lang.Object
org.apache.flink.runtime.io.network.api.writer.MultipleRecordWriters<T>
All Implemented Interfaces:
AutoCloseable, AvailabilityProvider, RecordWriterDelegate<T>

public class MultipleRecordWriters<T extends org.apache.flink.core.io.IOReadableWritable> extends Object implements RecordWriterDelegate<T>
The specific delegate implementation for the multiple outputs case.
  • Constructor Details

    • MultipleRecordWriters

      public MultipleRecordWriters(List<RecordWriter<T>> recordWriters)
  • Method Details

    • broadcastEvent

      public void broadcastEvent(AbstractEvent event) throws IOException
      Description copied from interface: RecordWriterDelegate
      Broadcasts the provided event to all the internal record writer instances.
      Specified by:
      broadcastEvent in interface RecordWriterDelegate<T extends org.apache.flink.core.io.IOReadableWritable>
      Parameters:
      event - the event to be emitted to all the output channels.
      Throws:
      IOException
    • getRecordWriter

      public RecordWriter<T> getRecordWriter(int outputIndex)
      Description copied from interface: RecordWriterDelegate
      Returns the internal actual record writer instance based on the output index.
      Specified by:
      getRecordWriter in interface RecordWriterDelegate<T extends org.apache.flink.core.io.IOReadableWritable>
      Parameters:
      outputIndex - the index respective to the record writer instance.
    • setMaxOverdraftBuffersPerGate

      public void setMaxOverdraftBuffersPerGate(int maxOverdraftBuffersPerGate)
      Description copied from interface: RecordWriterDelegate
      Sets the max overdraft buffer size of per gate.
      Specified by:
      setMaxOverdraftBuffersPerGate in interface RecordWriterDelegate<T extends org.apache.flink.core.io.IOReadableWritable>
    • getAvailableFuture

      public CompletableFuture<?> getAvailableFuture()
      Specified by:
      getAvailableFuture in interface AvailabilityProvider
      Returns:
      a future that is completed if the respective provider is available.
    • isAvailable

      public boolean isAvailable()
      Description copied from interface: AvailabilityProvider
      In order to best-effort avoid volatile access in CompletableFuture.isDone(), we check the condition of future == AVAILABLE firstly for getting probable performance benefits while hot looping.

      It is always safe to use this method in performance nonsensitive scenarios to get the precise state.

      Specified by:
      isAvailable in interface AvailabilityProvider
      Returns:
      true if this instance is available for further processing.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable