From 7c6a641a95b92641eb6ba01a9e4c814de5545286 Mon Sep 17 00:00:00 2001 From: Matthias Pohl Date: Wed, 27 Nov 2024 11:58:24 +0100 Subject: [PATCH] [hotfix][runtime] Adds missing @GuardedBy annotation --- .../runtime/leaderelection/StandaloneLeaderElection.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/leaderelection/StandaloneLeaderElection.java b/flink-runtime/src/main/java/org/apache/flink/runtime/leaderelection/StandaloneLeaderElection.java index ac873b33046dd6..aa408a24563e24 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/leaderelection/StandaloneLeaderElection.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/leaderelection/StandaloneLeaderElection.java @@ -21,6 +21,7 @@ import org.apache.flink.util.Preconditions; import javax.annotation.Nullable; +import javax.annotation.concurrent.GuardedBy; import java.util.UUID; @@ -34,7 +35,10 @@ public class StandaloneLeaderElection implements LeaderElection { private final Object lock = new Object(); private final UUID sessionID; - @Nullable private LeaderContender leaderContender; + + @GuardedBy("lock") + @Nullable + private LeaderContender leaderContender; public StandaloneLeaderElection(UUID sessionID) { this.sessionID = sessionID;