Github user tillrohrmann commented on a diff in the pull request: https://github.com/apache/flink/pull/5239#discussion_r165308709 --- Diff: flink-runtime/src/test/java/org/apache/flink/runtime/state/StateBackendTestBase.java --- @@ -3404,12 +3405,16 @@ public String fold(String acc, Integer value) throws Exception { } } - protected KeyedStateHandle runSnapshot(RunnableFuture<KeyedStateHandle> snapshotRunnableFuture) throws Exception { + protected KeyedStateHandle runSnapshot( + RunnableFuture<SnapshotResult<KeyedStateHandle>> snapshotRunnableFuture) throws Exception { + if(!snapshotRunnableFuture.isDone()) { Thread runner = new Thread(snapshotRunnableFuture); runner.start(); } - return snapshotRunnableFuture.get(); + + SnapshotResult<KeyedStateHandle> snapshotResult = snapshotRunnableFuture.get(); --- End diff -- Why are we spawning a new `Thread` if we block the current thread here? Wouldn't it be better to simply call `run` on the `RunnableFuture` if it is not yet done?
---