Class SourceOperatorStreamTask<T>
- java.lang.Object
-
- org.apache.flink.streaming.runtime.tasks.StreamTask<T,SourceOperator<T,?>>
-
- org.apache.flink.streaming.runtime.tasks.SourceOperatorStreamTask<T>
-
- All Implemented Interfaces:
CheckpointableTask
,CoordinatedTask
,TaskInvokable
,AsyncExceptionHandler
,ContainingTaskDetails
@Internal public class SourceOperatorStreamTask<T> extends StreamTask<T,SourceOperator<T,?>>
A subclass ofStreamTask
for executing theSourceOperator
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SourceOperatorStreamTask.AsyncDataOutputToOutput<T>
Implementation ofPushingAsyncDataInput.DataOutput
that wraps a specificOutput
.-
Nested classes/interfaces inherited from class org.apache.flink.streaming.runtime.tasks.StreamTask
StreamTask.CanEmitBatchOfRecordsChecker
-
-
Field Summary
-
Fields inherited from class org.apache.flink.streaming.runtime.tasks.StreamTask
checkpointStorage, configuration, inputProcessor, LOG, mailboxProcessor, mainOperator, operatorChain, recordWriter, stateBackend, systemTimerService, timerService, TRIGGER_THREAD_GROUP
-
-
Constructor Summary
Constructors Constructor Description SourceOperatorStreamTask(Environment env)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
advanceToEndOfEventTime()
Emits theMAX_WATERMARK
so that all registered timers are fired.protected void
declineCheckpoint(long checkpointId)
void
init()
Future<Void>
notifyCheckpointAbortAsync(long checkpointId, long latestCompletedCheckpointId)
Invoked when a checkpoint has been aborted, i.e., when the checkpoint coordinator has received a decline message from one task and try to abort the targeted checkpoint by notification.Future<Void>
notifyCheckpointSubsumedAsync(long checkpointId)
Invoked when a checkpoint has been subsumed, i.e., when the checkpoint coordinator has confirmed one checkpoint has been finished, and try to remove the first previous checkpoint.CompletableFuture<Boolean>
triggerCheckpointAsync(CheckpointMetaData checkpointMetaData, CheckpointOptions checkpointOptions)
This method is called to trigger a checkpoint, asynchronously by the checkpoint coordinator.-
Methods inherited from class org.apache.flink.streaming.runtime.tasks.StreamTask
abortCheckpointOnBarrier, afterInvoke, cancel, cancelTask, cleanUp, cleanUpInternal, createRecordWriterDelegate, createStreamTaskStateInitializer, dispatchOperatorEvent, endData, finalize, getAsyncCheckpointStartDelayNanos, getAsyncOperationsThreadPool, getCancelables, getCanEmitBatchOfRecords, getCheckpointBarrierHandler, getCheckpointStorage, getCompletionFuture, getConfiguration, getEnvironment, getMailboxExecutorFactory, getName, getProcessingTimeServiceFactory, handleAsyncException, hasMail, invoke, isCanceled, isFailing, isMailboxLoopRunning, isRunning, isUsingNonBlockingInput, maybeInterruptOnCancel, notifyCheckpointCompleteAsync, notifyEndOfData, processInput, restore, runMailboxLoop, runMailboxStep, runSingleMailboxLoop, setSynchronousSavepoint, setupNumRecordsInCounter, toString, triggerCheckpointOnBarrier
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.flink.streaming.runtime.tasks.ContainingTaskDetails
getExecutionConfig, getIndexInSubtaskGroup, getJobConfiguration, getUserCodeClassLoader
-
-
-
-
Constructor Detail
-
SourceOperatorStreamTask
public SourceOperatorStreamTask(Environment env) throws Exception
- Throws:
Exception
-
-
Method Detail
-
init
public void init() throws Exception
- Specified by:
init
in classStreamTask<T,SourceOperator<T,?>>
- Throws:
Exception
-
triggerCheckpointAsync
public CompletableFuture<Boolean> triggerCheckpointAsync(CheckpointMetaData checkpointMetaData, CheckpointOptions checkpointOptions)
Description copied from interface:CheckpointableTask
This method is called to trigger a checkpoint, asynchronously by the checkpoint coordinator.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
CheckpointableTask.triggerCheckpointOnBarrier(CheckpointMetaData, CheckpointOptions, CheckpointMetricsBuilder)
method.- Specified by:
triggerCheckpointAsync
in interfaceCheckpointableTask
- Overrides:
triggerCheckpointAsync
in classStreamTask<T,SourceOperator<T,?>>
- Parameters:
checkpointMetaData
- Meta data for about this checkpointcheckpointOptions
- Options for performing this checkpoint- Returns:
- future with value of
false
if the checkpoint was not carried out,true
otherwise
-
advanceToEndOfEventTime
protected void advanceToEndOfEventTime()
Description copied from class:StreamTask
Emits theMAX_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.
- Overrides:
advanceToEndOfEventTime
in classStreamTask<T,SourceOperator<T,?>>
-
declineCheckpoint
protected void declineCheckpoint(long checkpointId)
- Overrides:
declineCheckpoint
in classStreamTask<T,SourceOperator<T,?>>
-
notifyCheckpointAbortAsync
public Future<Void> notifyCheckpointAbortAsync(long checkpointId, long latestCompletedCheckpointId)
Description copied from interface:CheckpointableTask
Invoked when a checkpoint has been aborted, i.e., when the checkpoint coordinator has received a decline message from one task and try to abort the targeted checkpoint by notification.- Specified by:
notifyCheckpointAbortAsync
in interfaceCheckpointableTask
- Overrides:
notifyCheckpointAbortAsync
in classStreamTask<T,SourceOperator<T,?>>
- Parameters:
checkpointId
- The ID of the checkpoint that is aborted.latestCompletedCheckpointId
- The ID of the latest completed checkpoint.- Returns:
- future that completes when the notification has been processed by the task.
-
notifyCheckpointSubsumedAsync
public Future<Void> notifyCheckpointSubsumedAsync(long checkpointId)
Description copied from interface:CheckpointableTask
Invoked when a checkpoint has been subsumed, i.e., when the checkpoint coordinator has confirmed one checkpoint has been finished, and try to remove the first previous checkpoint.- Specified by:
notifyCheckpointSubsumedAsync
in interfaceCheckpointableTask
- Overrides:
notifyCheckpointSubsumedAsync
in classStreamTask<T,SourceOperator<T,?>>
- Parameters:
checkpointId
- The ID of the checkpoint that is subsumed.- Returns:
- future that completes when the notification has been processed by the task.
-
-