Merge "BUG 2317 : StatisticsManager does not unregister from yang notifications on...
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / example / ExampleActor.java
index 81b4670b71cb0eb728bed02d9c1da48163fc9b1f..2437bb4b7d381ff34a58138a14a7723ee7289a64 100644 (file)
@@ -27,7 +27,9 @@ import org.opendaylight.controller.cluster.example.messages.PrintRole;
 import org.opendaylight.controller.cluster.example.messages.PrintState;
 import org.opendaylight.controller.cluster.raft.ConfigParams;
 import org.opendaylight.controller.cluster.raft.RaftActor;
+import org.opendaylight.controller.cluster.raft.RaftState;
 import org.opendaylight.controller.cluster.raft.base.messages.CaptureSnapshotReply;
+import org.opendaylight.controller.cluster.raft.behaviors.Leader;
 import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
 
 /**
@@ -76,7 +78,15 @@ public class ExampleActor extends RaftActor {
 
         } else if (message instanceof PrintRole) {
             if(LOG.isDebugEnabled()) {
-                LOG.debug("{} = {}, Peers={}", getId(), getRaftState(), getPeers());
+                String followers = "";
+                if (getRaftState() == RaftState.Leader) {
+                    followers = ((Leader)this.getCurrentBehavior()).printFollowerStates();
+                    LOG.debug("{} = {}, Peers={}, followers={}", getId(), getRaftState(), getPeers(), followers);
+                } else {
+                    LOG.debug("{} = {}, Peers={}", getId(), getRaftState(), getPeers());
+                }
+
+
             }
 
         } else {