BUG-5626: do not allow overriding of RaftActor.handleCommand()
[controller.git] / opendaylight / md-sal / sal-akka-raft-example / src / main / java / org / opendaylight / controller / cluster / example / ExampleActor.java
index 9b7c2e8d4b0f3af9d522a55616d86a82f72a9cda..87dede1086901d3c930be777d3d0fbd8642baa07 100644 (file)
@@ -57,7 +57,8 @@ public class ExampleActor extends RaftActor implements RaftActorRecoveryCohort,
         return Props.create(ExampleActor.class, id, peerAddresses, configParams);
     }
 
-    @Override public void onReceiveCommand(Object message) throws Exception{
+    @Override
+    protected void handleNonRaftCommand(Object message) {
         if(message instanceof KeyValue){
             if(isLeader()) {
                 String persistId = Long.toString(persistIdentifier++);
@@ -89,7 +90,7 @@ public class ExampleActor extends RaftActor implements RaftActorRecoveryCohort,
             }
 
         } else {
-            super.onReceiveCommand(message);
+            super.handleNonRaftCommand(message);
         }
     }
 
@@ -145,7 +146,7 @@ public class ExampleActor extends RaftActor implements RaftActorRecoveryCohort,
         }
     }
 
-    private ByteString fromObject(Object snapshot) throws Exception {
+    private static ByteString fromObject(Object snapshot) throws Exception {
         ByteArrayOutputStream b = null;
         ObjectOutputStream o = null;
         try {
@@ -165,7 +166,7 @@ public class ExampleActor extends RaftActor implements RaftActorRecoveryCohort,
         }
     }
 
-    private Object toObject(byte [] bs) throws ClassNotFoundException, IOException {
+    private static Object toObject(byte [] bs) throws ClassNotFoundException, IOException {
         Object obj = null;
         ByteArrayInputStream bis = null;
         ObjectInputStream ois = null;
@@ -188,10 +189,6 @@ public class ExampleActor extends RaftActor implements RaftActorRecoveryCohort,
 
     }
 
-    @Override public void onReceiveRecover(Object message)throws Exception {
-        super.onReceiveRecover(message);
-    }
-
     @Override public String persistenceId() {
         return getId();
     }