Hi,

I have a question about implementing method of SourceFunction.

I'm trying to implement my own SourceFunction using Flink 1.11.3.

The following javadoc says that SourceFunction which implements
CheckpointedFunction should use synchronized block to perform checkpointing
and emission of elements atomically.


See
https://ci.apache.org/projects/flink/flink-docs-master/api/java/org/apache/flink/streaming/api/functions/source/SourceFunction.
html



On the other hand, from the implementation of StreamSourceContexts and
StreamTaskActionExecutor, it looks like that the SourceContext.collect and
checkpointing processes are exclusive.

I’m sorry if I misunderstood.


https://github.com/apache/flink/blob/master/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamSourceContexts.java#L106

https://github.com/apache/flink/blob/release-1.11.3/flink-streaming-https://github.com/apache/flink/blob/release-1.11.3/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTaskActionExecutor.java#L91



My Question is that is the synchronized block in SourceFunction necessary?

And why is it necessary?




Best regards,

-- 
Kazunori Shinhira
Mail : [email protected]

Reply via email to