Hi. Are Flink's timer service & Collector thre...
# troubleshooting
i
Hi. Are Flink's timer service & Collector thread-safe? Async operation & Future callback was added as the State API was upgraded to v2. Will it be thread-safe to call the Timer service & Collector from that callback? Example
Copy code
final var stateFuture = state.asyncValue();
stateFuture.thenAccept(value -> {
    ctx.timerService().registerEventTimeTimer(timestamp + someValue);
    out.collect(foo(value));
});
z
All the callbacks are run in the same thread, so it's safe
πŸ™ 1
πŸ˜€ 1
i
Thank you for your help! Can I see the relevant document?
"Although the state access methods are executed out of order, this not mean that all the user code are run in parallel. The user code in the
processElement
,
flatMap
or
thenXXxx
methods following the state access methods will be executed in a single thread (the task thread). So there is no concurrency issue for the user code."
i
Oh! Very thanks for your help!!! It resolved!
πŸ˜€ 1