flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kien Truong <duckientru...@gmail.com>
Subject Re: Apache Flink - Question about thread safety for stateful collections (MapState)
Date Sun, 12 Nov 2017 01:47:54 GMT
Hi Mans,

They're not executed in the same thread, but the methods that called 
them are synchronized[1] and therefore thread-safe.

Best regards,

Kien

[1] 
https://github.com/apache/flink/blob/1cd3ba3f2af454bc33f2c880163c01dddd4d1738/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/StreamInputProcessor.java#L204


On 11/12/2017 4:30 AM, M Singh wrote:
> Hi:
>
> I am working on a project and need to save MapState in a process 
> function and register a timer to check for updates.  I wanted to find 
> out if it is safe to access and modify the state in the 
> processElement function as well as the time onTimer methods.
>
> The example 
> https://ci.apache.org/projects/flink/flink-docs-release-1.3/dev/stream/process_function.html use

> ValueState and does not use synchronization. Is it because 
> processElement and onTimer are executed in the same thread and so are 
> thread safe ?
>
> Also, I could not find any thread safety documentation about MapState.
>
> Thanks.
>
> Mans
>
>

Mime
View raw message