Bug 5740: Add ControlMessage interface to raft messages 76/57776/3
authorTom Pantelis <tompantelis@gmail.com>
Wed, 24 May 2017 14:58:57 +0000 (10:58 -0400)
committerRobert Varga <nite@hq.sk>
Sun, 28 May 2017 20:34:39 +0000 (20:34 +0000)
Added 'implements ControlMessage' for all RaftRPCs and other messages
related to raft that should have higher priority.

Change-Id: Ie699531ef67d9cbcf7cbdec0422dd2e6faafebaa
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
14 files changed:
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/ApplySnapshot.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/ApplyState.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/CaptureSnapshot.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/CaptureSnapshotReply.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/ElectionTimeout.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/SendHeartBeat.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/SnapshotComplete.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/TimeoutNow.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/GetOnDemandRaftState.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/Shutdown.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/RaftRPC.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/UnInitializedFollowerSnapshotReply.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/ApplyJournalEntries.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/NoopPayload.java

index 9cf2a3f..7fec7e2 100644 (file)
@@ -8,6 +8,7 @@
 
 package org.opendaylight.controller.cluster.raft.base.messages;
 
+import akka.dispatch.ControlMessage;
 import com.google.common.base.Preconditions;
 import javax.annotation.Nonnull;
 import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
@@ -15,7 +16,7 @@ import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
 /**
  * Internal message, issued by follower to its actor.
  */
-public class ApplySnapshot {
+public class ApplySnapshot implements ControlMessage {
     private static final Callback NOOP_CALLBACK = new Callback() {
         @Override
         public void onSuccess() {
index 498d8d3..10ee1d0 100644 (file)
@@ -9,13 +9,14 @@
 package org.opendaylight.controller.cluster.raft.base.messages;
 
 import akka.actor.ActorRef;
+import akka.dispatch.ControlMessage;
 import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
 import org.opendaylight.yangtools.concepts.Identifier;
 
 /**
  * Local message sent by a RaftActor to itself to signal state has been applied to the state machine.
  */
-public class ApplyState {
+public class ApplyState implements ControlMessage {
     private final ActorRef clientActor;
     private final Identifier identifier;
     private final ReplicatedLogEntry replicatedLogEntry;
index 2173534..2a54d7a 100644 (file)
@@ -8,11 +8,12 @@
 
 package org.opendaylight.controller.cluster.raft.base.messages;
 
+import akka.dispatch.ControlMessage;
 import java.util.Collections;
 import java.util.List;
 import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
 
-public class CaptureSnapshot {
+public class CaptureSnapshot implements ControlMessage {
     private final long lastAppliedIndex;
     private final long lastAppliedTerm;
     private final long lastIndex;
index cc981e5..f0e16a0 100644 (file)
@@ -7,13 +7,14 @@
  */
 package org.opendaylight.controller.cluster.raft.base.messages;
 
+import akka.dispatch.ControlMessage;
 import com.google.common.base.Preconditions;
 import java.io.OutputStream;
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
 
-public class CaptureSnapshotReply {
+public class CaptureSnapshotReply implements ControlMessage {
     private final Snapshot.State snapshotState;
     private final Optional<OutputStream> installSnapshotStream;
 
index 606835e..7f367f9 100644 (file)
@@ -8,10 +8,12 @@
 
 package org.opendaylight.controller.cluster.raft.base.messages;
 
+import akka.dispatch.ControlMessage;
+
 /**
  * Local message sent to indicate the current election term has timed out.
  */
-public final class ElectionTimeout {
+public final class ElectionTimeout implements ControlMessage {
     public static final ElectionTimeout INSTANCE = new ElectionTimeout();
 
     private ElectionTimeout() {
index 31d15dd..b3e44f0 100644 (file)
@@ -8,10 +8,12 @@
 
 package org.opendaylight.controller.cluster.raft.base.messages;
 
+import akka.dispatch.ControlMessage;
+
 /**
  * This messages is sent via a schedule to the Leader to prompt it to send a heart beat to its followers.
  */
-public final class SendHeartBeat {
+public final class SendHeartBeat implements ControlMessage {
     public static final SendHeartBeat INSTANCE = new SendHeartBeat();
 
     private SendHeartBeat() {
index d0329ed..cc20cf6 100644 (file)
@@ -7,12 +7,14 @@
  */
 package org.opendaylight.controller.cluster.raft.base.messages;
 
+import akka.dispatch.ControlMessage;
+
 /**
  * Internal message sent when a snapshot capture is complete.
  *
  * @author Thomas Pantelis
  */
-public class SnapshotComplete {
+public class SnapshotComplete implements ControlMessage {
     public static final SnapshotComplete INSTANCE = new SnapshotComplete();
 
     private SnapshotComplete() {
index b85d8b7..b212250 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.controller.cluster.raft.base.messages;
 
+import akka.dispatch.ControlMessage;
 import java.io.Serializable;
 
 /**
@@ -14,7 +15,7 @@ import java.io.Serializable;
  *
  * @author Thomas Pantelis
  */
-public final class TimeoutNow implements Serializable {
+public final class TimeoutNow implements Serializable, ControlMessage {
     private static final long serialVersionUID = 1L;
     public static final TimeoutNow INSTANCE = new TimeoutNow();
 
index be04386..a1083eb 100644 (file)
@@ -7,13 +7,15 @@
  */
 package org.opendaylight.controller.cluster.raft.client.messages;
 
+import akka.dispatch.ControlMessage;
+
 /**
  * Local message sent to a RaftActor to obtain a snapshot of statistical information. Returns an
  * OnDemandRaftState instance.
  *
  * @author Thomas Pantelis
  */
-public class GetOnDemandRaftState {
+public class GetOnDemandRaftState implements ControlMessage {
     public static final GetOnDemandRaftState INSTANCE = new GetOnDemandRaftState();
 
     private GetOnDemandRaftState() {
index 22acc41..b670243 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.controller.cluster.raft.client.messages;
 
+import akka.dispatch.ControlMessage;
 import java.io.Serializable;
 import org.opendaylight.controller.cluster.raft.base.messages.EmptyExternalizableProxy;
 
@@ -17,7 +18,7 @@ import org.opendaylight.controller.cluster.raft.base.messages.EmptyExternalizabl
  *
  * @author Thomas Pantelis
  */
-public final class Shutdown implements Serializable {
+public final class Shutdown implements Serializable, ControlMessage {
     private static final long serialVersionUID = 1L;
     public static final Shutdown INSTANCE = new Shutdown();
 
index b3c1667..ac99000 100644 (file)
@@ -8,12 +8,13 @@
 
 package org.opendaylight.controller.cluster.raft.messages;
 
+import akka.dispatch.ControlMessage;
 import java.io.Serializable;
 
 /**
  * Interface implemented by all requests exchanged in the Raft protocol.
  */
-public interface RaftRPC extends Serializable {
+public interface RaftRPC extends Serializable, ControlMessage {
     /**
      * Return the term in which this call is being made.
      *
index f5c44f8..ff11ca0 100644 (file)
@@ -7,11 +7,13 @@
  */
 package org.opendaylight.controller.cluster.raft.messages;
 
+import akka.dispatch.ControlMessage;
+
 /**
  * Local message sent to self on receiving the InstallSnapshotReply from a follower indicating that
  * the catch up of the follower has completed successfully for an AddServer operation.
  */
-public class  UnInitializedFollowerSnapshotReply {
+public class UnInitializedFollowerSnapshotReply implements ControlMessage {
     private final String followerId;
 
     public UnInitializedFollowerSnapshotReply(String followerId) {
index 6045427..ef3c866 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.controller.cluster.raft.persisted;
 
+import akka.dispatch.ControlMessage;
 import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
@@ -21,7 +22,7 @@ import java.io.Serializable;
  *
  * @author Thomas Pantelis
  */
-public class ApplyJournalEntries implements Serializable {
+public class ApplyJournalEntries implements Serializable, ControlMessage {
     private static final class Proxy implements Externalizable {
         private static final long serialVersionUID = 1L;
 
index 782bb72..46628c6 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.controller.cluster.raft.persisted;
 
+import akka.dispatch.ControlMessage;
 import java.io.Serializable;
 import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
 
@@ -16,14 +17,13 @@ import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payloa
  *
  * @author Thomas Pantelis
  */
-public final class NoopPayload extends Payload implements Serializable {
+public final class NoopPayload extends Payload implements Serializable, ControlMessage {
     public static final NoopPayload INSTANCE = new NoopPayload();
 
     // There is no need for Externalizable
     private static final class Proxy implements Serializable {
         private static final long serialVersionUID = 1L;
 
-        @SuppressWarnings("static-method")
         private Object readResolve() {
             return INSTANCE;
         }
@@ -40,7 +40,6 @@ public final class NoopPayload extends Payload implements Serializable {
         return 0;
     }
 
-    @SuppressWarnings("static-method")
     private Object writeReplace() {
         return PROXY;
     }

©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.