OUT - The type of elements accepted by the chain, i.e., the input type of the chain's main
operator.@Internal public class OperatorChain<OUT,OP extends StreamOperator<OUT>> extends Object implements StreamStatusMaintainer, BoundedMultiInput, Closeable
OperatorChain contains all operators that are executed as one chain within a single
StreamTask.
The main entry point to the chain is it's mainOperator. mainOperator is
driving the execution of the StreamTask, by pulling the records from network inputs
and/or source inputs and pushing produced records to the remaining chained operators.
| Modifier and Type | Class and Description |
|---|---|
static class |
OperatorChain.ChainedSource
Wrapper class to access the chained sources and their's outputs.
|
| Constructor and Description |
|---|
OperatorChain(StreamTask<OUT,OP> containingTask,
org.apache.flink.runtime.io.network.api.writer.RecordWriterDelegate<org.apache.flink.runtime.plugable.SerializationDelegate<StreamRecord<OUT>>> recordWriterDelegate) |
| Modifier and Type | Method and Description |
|---|---|
void |
broadcastEvent(org.apache.flink.runtime.event.AbstractEvent event) |
void |
broadcastEvent(org.apache.flink.runtime.event.AbstractEvent event,
boolean isPriorityEvent) |
void |
close()
This method releases all resources of the record writer output.
|
protected void |
closeOperators(StreamTaskActionExecutor actionExecutor)
Closes all operators in a chain effect way.
|
void |
dispatchOperatorEvent(org.apache.flink.runtime.jobgraph.OperatorID operator,
org.apache.flink.util.SerializedValue<org.apache.flink.runtime.operators.coordination.OperatorEvent> event) |
void |
endInput(int inputId)
Ends the main operator input specified by
inputId). |
void |
flushOutputs()
This method should be called before finishing the record emission, to make sure any data that
is still buffered will be sent.
|
Iterable<StreamOperatorWrapper<?,?>> |
getAllOperators()
Returns an
Iterable which traverses all operators in forward topological order. |
Iterable<StreamOperatorWrapper<?,?>> |
getAllOperators(boolean reverse)
Returns an
Iterable which traverses all operators in forward or reverse topological
order. |
Output<StreamRecord<?>> |
getChainedSourceOutput(StreamConfig.SourceInputConfig sourceInput) |
List<Output<StreamRecord<?>>> |
getChainedSourceOutputs() |
OP |
getMainOperator() |
WatermarkGaugeExposingOutput<StreamRecord<OUT>> |
getMainOperatorOutput() |
int |
getNumberOfOperators() |
org.apache.flink.runtime.operators.coordination.OperatorEventDispatcher |
getOperatorEventDispatcher() |
StreamTaskSourceInput<?> |
getSourceTaskInput(StreamConfig.SourceInputConfig sourceInput) |
List<StreamTaskSourceInput<?>> |
getSourceTaskInputs() |
RecordWriterOutput<?>[] |
getStreamOutputs() |
StreamStatus |
getStreamStatus()
Returns the current stream status.
|
protected void |
initializeStateAndOpenOperators(StreamTaskStateInitializer streamTaskStateInitializer)
Initialize state and open all operators in the chain from tail to heads, contrary to
StreamOperator.close() which happens heads to tail (see closeOperators(StreamTaskActionExecutor)). |
void |
prepareSnapshotPreBarrier(long checkpointId) |
void |
setIgnoreEndOfInput(boolean ignoreEndOfInput) |
void |
toggleStreamStatus(StreamStatus status)
Toggles the current stream status.
|
public OperatorChain(StreamTask<OUT,OP> containingTask, org.apache.flink.runtime.io.network.api.writer.RecordWriterDelegate<org.apache.flink.runtime.plugable.SerializationDelegate<StreamRecord<OUT>>> recordWriterDelegate)
public StreamStatus getStreamStatus()
StreamStatusProvidergetStreamStatus in interface StreamStatusProviderpublic org.apache.flink.runtime.operators.coordination.OperatorEventDispatcher getOperatorEventDispatcher()
public void dispatchOperatorEvent(org.apache.flink.runtime.jobgraph.OperatorID operator,
org.apache.flink.util.SerializedValue<org.apache.flink.runtime.operators.coordination.OperatorEvent> event)
throws org.apache.flink.util.FlinkException
org.apache.flink.util.FlinkExceptionpublic void toggleStreamStatus(StreamStatus status)
StreamStatusMaintainertoggleStreamStatus in interface StreamStatusMaintainerstatus - the new status to toggle topublic void broadcastEvent(org.apache.flink.runtime.event.AbstractEvent event)
throws IOException
IOExceptionpublic void broadcastEvent(org.apache.flink.runtime.event.AbstractEvent event,
boolean isPriorityEvent)
throws IOException
IOExceptionpublic void prepareSnapshotPreBarrier(long checkpointId)
throws Exception
Exceptionpublic void endInput(int inputId)
throws Exception
inputId).endInput in interface BoundedMultiInputinputId - the input ID starts from 1 which indicates the first input.Exceptionprotected void initializeStateAndOpenOperators(StreamTaskStateInitializer streamTaskStateInitializer) throws Exception
StreamOperator.close() which happens heads to tail (see closeOperators(StreamTaskActionExecutor)).Exceptionprotected void closeOperators(StreamTaskActionExecutor actionExecutor) throws Exception
StreamOperator.open() which happens tail to
heads (see initializeStateAndOpenOperators(StreamTaskStateInitializer)).Exceptionpublic RecordWriterOutput<?>[] getStreamOutputs()
public Iterable<StreamOperatorWrapper<?,?>> getAllOperators()
Iterable which traverses all operators in forward topological order.public Iterable<StreamOperatorWrapper<?,?>> getAllOperators(boolean reverse)
Iterable which traverses all operators in forward or reverse topological
order.public int getNumberOfOperators()
public WatermarkGaugeExposingOutput<StreamRecord<OUT>> getMainOperatorOutput()
public Output<StreamRecord<?>> getChainedSourceOutput(StreamConfig.SourceInputConfig sourceInput)
public List<Output<StreamRecord<?>>> getChainedSourceOutputs()
public StreamTaskSourceInput<?> getSourceTaskInput(StreamConfig.SourceInputConfig sourceInput)
public List<StreamTaskSourceInput<?>> getSourceTaskInputs()
public void flushOutputs()
throws IOException
IOException - Thrown, if the buffered data cannot be pushed into the output streams.public void close()
throws IOException
This method should never fail.
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic void setIgnoreEndOfInput(boolean ignoreEndOfInput)
Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.