Move FollowerInfo 07/93307/4
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 23 Oct 2020 16:07:01 +0000 (18:07 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 23 Oct 2020 17:03:02 +0000 (19:03 +0200)
DataTreeListenerInfo is strictly JMX-related, hence it should not
be lurking among our messages. Move it to cluster.mgmt.api package.

Strictly speaking this is not API-compatible, but previous location
was in implementation-specific place, so that should be fine.

JIRA: CONTROLLER-1965
Change-Id: I901887ee7f1827ba25076252bf5ffb32cf6faf45
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/cds-mgmt-api/src/main/java/org/opendaylight/controller/cluster/mgmt/api/FollowerInfo.java [moved from opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/FollowerInfo.java with 77% similarity]
opendaylight/md-sal/sal-akka-raft/pom.xml
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/client/messages/OnDemandRaftState.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardStats.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStatsMXBean.java

@@ -5,16 +5,20 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.raft.client.messages;
+package org.opendaylight.controller.cluster.mgmt.api;
+
+import static java.util.Objects.requireNonNull;
 
 import javax.management.ConstructorParameters;
+import org.eclipse.jdt.annotation.NonNullByDefault;
 
 /**
  * A bean class containing a snapshot of information for a follower returned from GetOnDemandRaftStats.
  *
  * @author Thomas Pantelis
  */
-public class FollowerInfo {
+@NonNullByDefault
+public final class FollowerInfo {
     private final String id;
     private final long nextIndex;
     private final long matchIndex;
@@ -23,9 +27,9 @@ public class FollowerInfo {
     private final boolean isVoting;
 
     @ConstructorParameters({"id","nextIndex", "matchIndex", "active", "timeSinceLastActivity", "voting"})
-    public FollowerInfo(String id, long nextIndex, long matchIndex, boolean active, String timeSinceLastActivity,
-            boolean voting) {
-        this.id = id;
+    public FollowerInfo(final String id, final long nextIndex, final long matchIndex, final boolean active,
+            final String timeSinceLastActivity, final boolean voting) {
+        this.id = requireNonNull(id);
         this.nextIndex = nextIndex;
         this.matchIndex = matchIndex;
         this.isActive = active;
index ace6f2d..881dc82 100644 (file)
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal-clustering-commons</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>cds-mgmt-api</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>repackaged-akka</artifactId>
index 7148986..3bedc59 100644 (file)
@@ -32,6 +32,7 @@ import org.opendaylight.controller.cluster.DelegatingPersistentDataProvider;
 import org.opendaylight.controller.cluster.NonPersistentDataProvider;
 import org.opendaylight.controller.cluster.PersistentDataProvider;
 import org.opendaylight.controller.cluster.common.actor.AbstractUntypedPersistentActor;
+import org.opendaylight.controller.cluster.mgmt.api.FollowerInfo;
 import org.opendaylight.controller.cluster.notifications.LeaderStateChanged;
 import org.opendaylight.controller.cluster.notifications.RoleChanged;
 import org.opendaylight.controller.cluster.raft.base.messages.ApplyState;
@@ -46,7 +47,6 @@ import org.opendaylight.controller.cluster.raft.behaviors.Follower;
 import org.opendaylight.controller.cluster.raft.behaviors.RaftActorBehavior;
 import org.opendaylight.controller.cluster.raft.client.messages.FindLeader;
 import org.opendaylight.controller.cluster.raft.client.messages.FindLeaderReply;
-import org.opendaylight.controller.cluster.raft.client.messages.FollowerInfo;
 import org.opendaylight.controller.cluster.raft.client.messages.GetOnDemandRaftState;
 import org.opendaylight.controller.cluster.raft.client.messages.OnDemandRaftState;
 import org.opendaylight.controller.cluster.raft.client.messages.Shutdown;
index 7a2831b..d150b3a 100644 (file)
@@ -17,8 +17,8 @@ import java.util.concurrent.atomic.AtomicLong;
 import org.checkerframework.checker.lock.qual.GuardedBy;
 import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardStatsMXBean;
+import org.opendaylight.controller.cluster.mgmt.api.FollowerInfo;
 import org.opendaylight.controller.cluster.raft.base.messages.InitiateCaptureSnapshot;
-import org.opendaylight.controller.cluster.raft.client.messages.FollowerInfo;
 import org.opendaylight.controller.cluster.raft.client.messages.OnDemandRaftState;
 import org.opendaylight.controller.md.sal.common.util.jmx.AbstractMXBean;
 

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.