简体   繁体   中英

flink Operator State is thread safe?

With Operator State (or non-keyed state), each operator state is bound to one parallel operator instance

The above quote is from the official Flink website. Each parallel operator instance may have thread pool. When these threads access the Operator State (as described above, each parallel operator instance can have one operator state), would it encounter a thread-safe problem? Should I use Operator State with terminology like below in Java?

synchronize(stateInstance){
//update state
}

I wonder what do you mean thread pool and how will it interact with Flink managed state?

If the thread pool you mentioned in the question is Flink task running on the Flink TaskManager. Then it is thread-safe . Flink is a distributed system. It executes the task with parallel operator instances, so the managed state of each operator instance is thread-safe naturally.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM