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.
configuration, headOperator, inputProcessor, LOG, mailboxProcessor, operatorChain, stateBackend, timerService, TRIGGER_THREAD_GROUP
Constructor and Description |
---|
SourceStreamTask(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 |
cleanUpInvoke() |
protected void |
declineCheckpoint(long checkpointId) |
protected void |
finishTask()
Instructs the task to go through its normal termination routine, i.e.
|
protected CompletableFuture<Void> |
getCompletionFuture() |
protected void |
init() |
protected void |
processInput(MailboxDefaultAction.Controller controller)
This method implements the default action of the task (e.g.
|
Future<Boolean> |
triggerCheckpointAsync(CheckpointMetaData checkpointMetaData,
CheckpointOptions checkpointOptions)
This method is called to trigger a checkpoint, asynchronously by the checkpoint coordinator.
|
abortCheckpointOnBarrier, afterInvoke, beforeInvoke, cancel, createRecordWriterDelegate, createStreamTaskStateInitializer, dispatchOperatorEvent, executeInTaskThread, finalize, getAsyncCheckpointStartDelayNanos, getAsyncOperationsThreadPool, getCancelables, getCheckpointStorage, getConfiguration, getMailboxExecutorFactory, getName, getProcessingTimeServiceFactory, getStreamStatusMaintainer, handleAsyncException, invoke, isCanceled, isFailing, isMailboxLoopRunning, isRunning, notifyCheckpointAbortAsync, notifyCheckpointCompleteAsync, runMailboxStep, setupNumRecordsInCounter, toString, triggerCheckpointOnBarrier
getCurrentNumberOfSubtasks, getEnvironment, getExecutionConfig, getIndexInSubtaskGroup, getJobConfiguration, getTaskConfiguration, getUserCodeClassLoader, setShouldInterruptOnCancel, shouldInterruptOnCancel
public SourceStreamTask(Environment env) throws Exception
Exception
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(MailboxDefaultAction.Controller controller) throws Exception
StreamTask
processInput
in class StreamTask<OUT,OP extends StreamSource<OUT,SRC>>
controller
- controller object for collaborative interaction between the action and the
stream task.Exception
- on any problems in the action.protected void cleanUpInvoke() throws Exception
cleanUpInvoke
in class StreamTask<OUT,OP extends StreamSource<OUT,SRC>>
Exception
protected void cancelTask()
cancelTask
in class StreamTask<OUT,OP extends StreamSource<OUT,SRC>>
protected void finishTask()
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 stopped with a savepoint.
For tasks other than the source task, this method does nothing.
finishTask
in class StreamTask<OUT,OP extends StreamSource<OUT,SRC>>
protected CompletableFuture<Void> getCompletionFuture()
getCompletionFuture
in class StreamTask<OUT,OP extends StreamSource<OUT,SRC>>
public Future<Boolean> triggerCheckpointAsync(CheckpointMetaData checkpointMetaData, CheckpointOptions checkpointOptions)
AbstractInvokable
This method is called for tasks that start the checkpoints by injecting the initial
barriers, i.e., the source tasks. In contrast, checkpoints on downstream operators, which are
the result of receiving checkpoint barriers, invoke the AbstractInvokable.triggerCheckpointOnBarrier(CheckpointMetaData, CheckpointOptions, CheckpointMetrics)
method.
triggerCheckpointAsync
in class StreamTask<OUT,OP extends StreamSource<OUT,SRC>>
checkpointMetaData
- Meta data for about this checkpointcheckpointOptions
- Options for performing this checkpointfalse
if the checkpoint was not carried out, true
otherwiseprotected void declineCheckpoint(long checkpointId)
declineCheckpoint
in class StreamTask<OUT,OP extends StreamSource<OUT,SRC>>
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.