Merge "Bug #1532 Neutron Port bindings missing Security Group List"
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / ThreePhaseCommitCohort.java
index 060c9d6b509ab26f481a59c492da753ab70a2400..500b73ce9de6531c3a1d60df3e192dea18dc4606 100644 (file)
@@ -58,14 +58,16 @@ public class ThreePhaseCommitCohort extends AbstractUntypedActor {
 
     @Override
     public void handleReceive(Object message) throws Exception {
-        if (message instanceof CanCommitTransaction) {
-            canCommit((CanCommitTransaction) message);
-        } else if (message instanceof PreCommitTransaction) {
-            preCommit((PreCommitTransaction) message);
-        } else if (message instanceof CommitTransaction) {
-            commit((CommitTransaction) message);
-        } else if (message instanceof AbortTransaction) {
-            abort((AbortTransaction) message);
+        if (message.getClass().equals(CanCommitTransaction.SERIALIZABLE_CLASS)) {
+            canCommit(new CanCommitTransaction());
+        } else if (message.getClass().equals(PreCommitTransaction.SERIALIZABLE_CLASS)) {
+            preCommit(new PreCommitTransaction());
+        } else if (message.getClass().equals(CommitTransaction.SERIALIZABLE_CLASS)) {
+            commit(new CommitTransaction());
+        } else if (message.getClass().equals(AbortTransaction.SERIALIZABLE_CLASS)) {
+            abort(new AbortTransaction());
+        } else {
+            unknownMessage(message);
         }
     }
 
@@ -79,7 +81,7 @@ public class ThreePhaseCommitCohort extends AbstractUntypedActor {
             public void run() {
                 try {
                     future.get();
-                    sender.tell(new AbortTransactionReply(), self);
+                    sender.tell(new AbortTransactionReply().toSerializable(), self);
                 } catch (InterruptedException | ExecutionException e) {
                     log.error(e, "An exception happened when aborting");
                 }
@@ -107,7 +109,7 @@ public class ThreePhaseCommitCohort extends AbstractUntypedActor {
             public void run() {
                 try {
                     future.get();
-                    sender.tell(new PreCommitTransactionReply(), self);
+                    sender.tell(new PreCommitTransactionReply().toSerializable(), self);
                 } catch (InterruptedException | ExecutionException e) {
                     log.error(e, "An exception happened when preCommitting");
                 }
@@ -126,9 +128,9 @@ public class ThreePhaseCommitCohort extends AbstractUntypedActor {
             public void run() {
                 try {
                     Boolean canCommit = future.get();
-                    sender.tell(new CanCommitTransactionReply(canCommit), self);
+                    sender.tell(new CanCommitTransactionReply(canCommit).toSerializable(), self);
                 } catch (InterruptedException | ExecutionException e) {
-                    log.error(e, "An exception happened when aborting");
+                    log.error(e, "An exception happened when checking canCommit");
                 }
             }
         }, getContext().dispatcher());