Remove RaftActorContextImpl.close() 28/115928/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 19 Mar 2025 15:12:22 +0000 (16:12 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 19 Mar 2025 15:12:22 +0000 (16:12 +0100)
We are indirecting to current behavior, just inline this login in
RaftActor.

Change-Id: I2ed629cd67e032058ecf922c9b51a31cea7e8d15
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActor.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContextImpl.java

index 3004681af9ee28dbe72adea80ab5659a8d2e5464..466d408b9b6631af1e0a7292a0c199f39a33c465 100644 (file)
@@ -157,8 +157,16 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void postStop() throws Exception {
-        context.close();
+        final var behavior = context.getCurrentBehavior();
+        if (behavior != null) {
+            try {
+                behavior.close();
+            } catch (Exception e) {
+                LOG.warn("{}: Error closing behavior {}", memberId(), behavior.state(), e);
+            }
+        }
         super.postStop();
     }
 
index 100adeb95d97db72b3bb10e9c79fed000cefebc1..707aafb69642084310b52660b18e6084577d4ba9 100644 (file)
@@ -421,17 +421,6 @@ public class RaftActorContextImpl implements RaftActorContext {
         return fileBackedOutputStreamFactory;
     }
 
-    @SuppressWarnings("checkstyle:IllegalCatch")
-    void close() {
-        if (currentBehavior != null) {
-            try {
-                currentBehavior.close();
-            } catch (Exception e) {
-                LOG.debug("{}: Error closing behavior {}", id, currentBehavior.state(), e);
-            }
-        }
-    }
-
     @Override
     public RaftActorLeadershipTransferCohort getRaftActorLeadershipTransferCohort() {
         return leadershipTransferCohort;