OUT
- Type of the output elements of this source.SRC
- Type of the source function for the stream source operatorOP
- Type of the stream source operator@Internal public class SourceStreamTask<OUT,SRC extends SourceFunction<OUT>,OP extends StreamSource<OUT,SRC>> extends StreamTask<OUT,OP>
StreamTask
for executing a StreamSource
.
One important aspect of this is that the checkpointing and the emission of elements must never
occur at the same time. The execution must be serial. This is achieved by having the contract
with the SourceFunction
that it must only modify its state or emit elements in
a synchronized block that locks on the lock Object. Also, the modification of the state
and the emission of elements must happen in the same block of code that is protected by the
synchronized block.
StreamTask.ActionContext, StreamTask.AsyncCheckpointRunnable
configuration, headOperator, inputProcessor, mailbox, operatorChain, stateBackend, timerService, TRIGGER_THREAD_GROUP
Constructor and Description |
---|
SourceStreamTask(org.apache.flink.runtime.execution.Environment env) |
Modifier and Type | Method and Description |
---|---|
protected void |
advanceToEndOfEventTime()
Emits the
MAX_WATERMARK
so that all registered timers are fired. |
protected void |
cancelTask() |
protected void |
cleanup() |
protected void |
finishTask()
Instructs the task to go through its normal termination routine, i.e.
|
Optional<Thread> |
getExecutingThread() |
protected void |
init() |
protected void |
processInput(StreamTask.ActionContext context)
This method implements the default action of the task (e.g.
|
boolean |
triggerCheckpoint(org.apache.flink.runtime.checkpoint.CheckpointMetaData checkpointMetaData,
org.apache.flink.runtime.checkpoint.CheckpointOptions checkpointOptions,
boolean advanceToEndOfEventTime) |
abortCheckpointOnBarrier, cancel, createCheckpointExceptionHandlerFactory, createRecordWriters, createStreamTaskStateInitializer, finalize, getAccumulatorMap, getAsyncOperationsThreadPool, getCancelables, getCheckpointLock, getCheckpointStorage, getConfiguration, getName, getProcessingTimeService, getStreamStatusMaintainer, handleAsyncException, invoke, isCanceled, isRunning, notifyCheckpointComplete, toString, triggerCheckpointOnBarrier
public SourceStreamTask(org.apache.flink.runtime.execution.Environment env)
protected void init()
init
in class StreamTask<OUT,OP extends StreamSource<OUT,SRC>>
protected void advanceToEndOfEventTime() throws Exception
StreamTask
MAX_WATERMARK
so that all registered timers are fired.
This is used by the source task when the job is TERMINATED
. In the case,
we want all the timers registered throughout the pipeline to fire and the related
state (e.g. windows) to be flushed.
For tasks other than the source task, this method does nothing.
advanceToEndOfEventTime
in class StreamTask<OUT,OP extends StreamSource<OUT,SRC>>
Exception
protected void cleanup()
cleanup
in class StreamTask<OUT,OP extends StreamSource<OUT,SRC>>
protected void processInput(StreamTask.ActionContext context) throws Exception
StreamTask
processInput
in class StreamTask<OUT,OP extends StreamSource<OUT,SRC>>
context
- context object for collaborative interaction between the action and the stream task.Exception
- on any problems in the action.protected void cancelTask()
cancelTask
in class StreamTask<OUT,OP extends StreamSource<OUT,SRC>>
protected void finishTask() throws Exception
StreamTask
StreamOperator.close()
and StreamOperator.dispose()
on its operators.
This is used by the source task to get out of the run-loop when the job is stoppped with a savepoint.
For tasks other than the source task, this method does nothing.
finishTask
in class StreamTask<OUT,OP extends StreamSource<OUT,SRC>>
Exception
public Optional<Thread> getExecutingThread()
getExecutingThread
in class org.apache.flink.runtime.jobgraph.tasks.AbstractInvokable
public boolean triggerCheckpoint(org.apache.flink.runtime.checkpoint.CheckpointMetaData checkpointMetaData, org.apache.flink.runtime.checkpoint.CheckpointOptions checkpointOptions, boolean advanceToEndOfEventTime) throws Exception
triggerCheckpoint
in class StreamTask<OUT,OP extends StreamSource<OUT,SRC>>
Exception
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.