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,
RecordWriterDelegate<SerializationDelegate<StreamRecord<OUT>>> recordWriterDelegate) |
Modifier and Type | Method and Description |
---|---|
void |
broadcastEvent(AbstractEvent event) |
void |
broadcastEvent(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(OperatorID operator,
SerializedValue<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() |
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, RecordWriterDelegate<SerializationDelegate<StreamRecord<OUT>>> recordWriterDelegate)
public StreamStatus getStreamStatus()
StreamStatusProvider
getStreamStatus
in interface StreamStatusProvider
public OperatorEventDispatcher getOperatorEventDispatcher()
public void dispatchOperatorEvent(OperatorID operator, SerializedValue<OperatorEvent> event) throws FlinkException
FlinkException
public void toggleStreamStatus(StreamStatus status)
StreamStatusMaintainer
toggleStreamStatus
in interface StreamStatusMaintainer
status
- the new status to toggle topublic void broadcastEvent(AbstractEvent event) throws IOException
IOException
public void broadcastEvent(AbstractEvent event, boolean isPriorityEvent) throws IOException
IOException
public void prepareSnapshotPreBarrier(long checkpointId) throws Exception
Exception
public void endInput(int inputId) throws Exception
inputId
).endInput
in interface BoundedMultiInput
inputId
- the input ID starts from 1 which indicates the first input.Exception
protected void initializeStateAndOpenOperators(StreamTaskStateInitializer streamTaskStateInitializer) throws Exception
StreamOperator.close()
which happens heads to tail (see closeOperators(StreamTaskActionExecutor)
).Exception
protected void closeOperators(StreamTaskActionExecutor actionExecutor) throws Exception
StreamOperator.open()
which happens tail to
heads (see initializeStateAndOpenOperators(StreamTaskStateInitializer)
).Exception
public 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 Closeable
close
in interface AutoCloseable
IOException
public void setIgnoreEndOfInput(boolean ignoreEndOfInput)
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.