Inline isPersistentPayload() 67/114967/2
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 28 Jan 2025 13:59:19 +0000 (14:59 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 28 Jan 2025 14:07:09 +0000 (15:07 +0100)
The only caller already accesses entry data, so let's inline this method
and also clean up onRecoveredJournalLogEntry() a bit.

JIRA: CONTROLLER-2073
Change-Id: I5be0d85631692612bdaa284dcd132232c2ca744a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorRecoverySupport.java

index f76ecc5beb48ffdbd846dcebdd01ca8755966569..c65bbdc665663e00211d5b2d63e36ba5effd92c3 100644 (file)
@@ -165,17 +165,18 @@ class RaftActorRecoverySupport {
                     logEntry.index(), logEntry.size());
         }
 
-        if (logEntry.getData() instanceof ServerConfigurationPayload payload) {
+        final var data = logEntry.getData();
+        if (data instanceof ServerConfigurationPayload payload) {
             context.updatePeerIds(payload);
         }
 
-        if (isMigratedPayload(logEntry)) {
+        if (isMigratedSerializable(data)) {
             hasMigratedDataRecovered = true;
         }
 
         if (context.getPersistenceProvider().isRecoveryApplicable()) {
             replicatedLog().append(logEntry);
-        } else if (!isPersistentPayload(logEntry)) {
+        } else if (!(data instanceof PersistentPayload)) {
             dataRecoveredWithPersistenceDisabled = true;
         }
     }
@@ -322,10 +323,6 @@ class RaftActorRecoverySupport {
         }
     }
 
-    private static boolean isPersistentPayload(final ReplicatedLogEntry repLogEntry) {
-        return repLogEntry.getData() instanceof PersistentPayload;
-    }
-
     private static boolean isMigratedPayload(final ReplicatedLogEntry repLogEntry) {
         return isMigratedSerializable(repLogEntry.getData());
     }