Cleanup ShardInformation 85/98385/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 10 Nov 2021 10:12:33 +0000 (11:12 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 10 Nov 2021 10:14:40 +0000 (11:14 +0100)
Drop unneeded 'this.' qualifiers and use a simple return expression
in getSerializedLeaderActor().

Change-Id: I9a11410f8bc6d8246bacf99fa86c42de85c328ae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardInformation.java

index ea882dc..cc3d5a9 100644 (file)
@@ -101,7 +101,7 @@ public final class ShardInformation {
     }
 
     void setLocalDataTree(final Optional<ReadOnlyDataTree> dataTree) {
-        this.localShardDataTree = dataTree;
+        localShardDataTree = dataTree;
     }
 
     Optional<ReadOnlyDataTree> getLocalShardDataTree() {
@@ -113,10 +113,10 @@ public final class ShardInformation {
     }
 
     void setDatastoreContext(final DatastoreContext newDatastoreContext, final ActorRef sender) {
-        this.datastoreContext = newDatastoreContext;
+        datastoreContext = newDatastoreContext;
         if (actor != null) {
             LOG.debug("Sending new DatastoreContext to {}", shardId);
-            actor.tell(this.datastoreContext, sender);
+            actor.tell(datastoreContext, sender);
         }
     }
 
@@ -152,17 +152,13 @@ public final class ShardInformation {
     }
 
     String getSerializedLeaderActor() {
-        if (isLeader()) {
-            return Serialization.serializedActorPath(getActor());
-        } else {
-            return addressResolver.resolve(leaderId);
-        }
+        return isLeader() ? Serialization.serializedActorPath(getActor()) : addressResolver.resolve(leaderId);
     }
 
     void setActorInitialized() {
         LOG.debug("Shard {} is initialized", shardId);
 
-        this.actorInitialized = true;
+        actorInitialized = true;
 
         notifyOnShardInitializedCallbacks();
     }
@@ -197,7 +193,7 @@ public final class ShardInformation {
     }
 
     void setRole(final String newRole) {
-        this.role = newRole;
+        role = newRole;
 
         notifyOnShardInitializedCallbacks();
     }
@@ -207,13 +203,13 @@ public final class ShardInformation {
     }
 
     void setFollowerSyncStatus(final boolean syncStatus) {
-        this.followerSyncStatus = syncStatus;
+        followerSyncStatus = syncStatus;
     }
 
     boolean isInSync() {
-        if (RaftState.Follower.name().equals(this.role)) {
+        if (RaftState.Follower.name().equals(role)) {
             return followerSyncStatus;
-        } else if (RaftState.Leader.name().equals(this.role)) {
+        } else if (RaftState.Leader.name().equals(role)) {
             return true;
         }
 
@@ -221,10 +217,10 @@ public final class ShardInformation {
     }
 
     boolean setLeaderId(final String newLeaderId) {
-        final boolean changed = !Objects.equals(this.leaderId, newLeaderId);
-        this.leaderId = newLeaderId;
+        final boolean changed = !Objects.equals(leaderId, newLeaderId);
+        leaderId = newLeaderId;
         if (newLeaderId != null) {
-            this.leaderAvailable = true;
+            leaderAvailable = true;
         }
         notifyOnShardInitializedCallbacks();
 
@@ -256,7 +252,7 @@ public final class ShardInformation {
     }
 
     void setActiveMember(final boolean isActiveMember) {
-        this.activeMember = isActiveMember;
+        activeMember = isActiveMember;
     }
 
     EffectiveModelContext getSchemaContext() {