X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FThreePhaseCommitCohort.java;h=500b73ce9de6531c3a1d60df3e192dea18dc4606;hb=eed379a371f49c487aab762c55443fad18613417;hp=060c9d6b509ab26f481a59c492da753ab70a2400;hpb=c2b14095fb5dbef1532dde5a1b40bd3b9111d019;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohort.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohort.java index 060c9d6b50..500b73ce9d 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohort.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohort.java @@ -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());