Package org.apache.flink.api.common.io
Class OutputFormatBase<OUT,V>
- java.lang.Object
-
- org.apache.flink.api.common.io.RichOutputFormat<OUT>
-
- org.apache.flink.api.common.io.OutputFormatBase<OUT,V>
-
- Type Parameters:
OUT- Type of the elements to write.
- All Implemented Interfaces:
Serializable,OutputFormat<OUT>
@Experimental public abstract class OutputFormatBase<OUT,V> extends RichOutputFormat<OUT>
OutputFormatBase is the common abstract class for output formats. It implements a flush mechanism and has a maximum number of concurrent requests.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.api.common.io.OutputFormat
OutputFormat.InitializationContext
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedOutputFormatBase(int maxConcurrentRequests, java.time.Duration maxConcurrentRequestsTimeout)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()Close the format waiting for pending writes and reports errors.voidopen(int taskNumber, int numTasks)Open the format and initializes the flush system.protected voidpostClose()Tear down the OutputFormat.protected voidpostOpen()Initialize the OutputFormat.protected abstract CompletionStage<V>send(OUT record)Send the actual record for writing.voidwriteRecord(OUT record)Asynchronously write a record and deal withmaxConcurrentRequests.-
Methods inherited from class org.apache.flink.api.common.io.RichOutputFormat
getRuntimeContext, setRuntimeContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.api.common.io.OutputFormat
configure, open
-
-
-
-
Method Detail
-
open
public final void open(int taskNumber, int numTasks)Open the format and initializes the flush system.- Parameters:
taskNumber- The number of the parallel instance.numTasks- The number of parallel tasks.
-
postOpen
protected void postOpen()
Initialize the OutputFormat. This method is called at the end ofopen(int, int).
-
writeRecord
public final void writeRecord(OUT record) throws IOException
Asynchronously write a record and deal withmaxConcurrentRequests. To specify how a record is written, please override thesend(Object)method.- Parameters:
record- The records to add to the output.- Throws:
IOException- Thrown, if the records could not be added due to an I/O problem.
-
send
protected abstract CompletionStage<V> send(OUT record)
Send the actual record for writing.- Returns:
- a CompletionStage that represents the writing task.
-
close
public final void close() throws IOExceptionClose the format waiting for pending writes and reports errors.- Throws:
IOException- Thrown, if the input could not be closed properly.
-
postClose
protected void postClose()
Tear down the OutputFormat. This method is called at the end ofclose().
-
-