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 StreamFunction 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.AsyncCheckpointRunnable
configuration, headOperator, operatorChain, stateBackend, timerService, TRIGGER_THREAD_GROUP
Constructor and Description |
---|
SourceStreamTask(Environment env) |
Modifier and Type | Method and Description |
---|---|
protected void |
cancelTask() |
protected void |
cleanup() |
protected void |
init() |
protected void |
run() |
boolean |
triggerCheckpoint(CheckpointMetaData checkpointMetaData,
CheckpointOptions checkpointOptions)
This method is called to trigger a checkpoint, asynchronously by the checkpoint
coordinator.
|
abortCheckpointOnBarrier, cancel, createCheckpointExceptionHandlerFactory, createStreamRecordWriters, createStreamTaskStateInitializer, finalize, getAccumulatorMap, getAsyncOperationsThreadPool, getCancelables, getCheckpointLock, getCheckpointStorage, getConfiguration, getName, getProcessingTimeService, getStreamStatusMaintainer, handleAsyncException, invoke, isCanceled, isRunning, notifyCheckpointComplete, toString, triggerCheckpointOnBarrier
getCurrentNumberOfSubtasks, getEnvironment, getExecutionConfig, getIndexInSubtaskGroup, getJobConfiguration, getTaskConfiguration, getUserCodeClassLoader
public SourceStreamTask(Environment env)
protected void init()
init
in class StreamTask<OUT,OP extends StreamSource<OUT,SRC>>
protected void cleanup()
cleanup
in class StreamTask<OUT,OP extends StreamSource<OUT,SRC>>
protected void run() throws Exception
run
in class StreamTask<OUT,OP extends StreamSource<OUT,SRC>>
Exception
protected void cancelTask() throws Exception
cancelTask
in class StreamTask<OUT,OP extends StreamSource<OUT,SRC>>
Exception
public boolean triggerCheckpoint(CheckpointMetaData checkpointMetaData, CheckpointOptions checkpointOptions) throws Exception
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.
triggerCheckpoint
in class StreamTask<OUT,OP extends StreamSource<OUT,SRC>>
checkpointMetaData
- Meta data for about this checkpointcheckpointOptions
- Options for performing this checkpointfalse
if the checkpoint can not be carried out, true
otherwiseException
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.