X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FThreePhaseCommitCohort.java;h=a8deb0153a400eefbf28fd4269892c86ea61ef35;hp=060c9d6b509ab26f481a59c492da753ab70a2400;hb=c222e37f2a0f0f3f6266242fbea2d3b018f4e6e3;hpb=cbe83ca3074fa0182d4f079f528bb710a997ced7 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..a8deb0153a 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 { + throw new Exception ("Not recognized message received,message="+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,7 +128,7 @@ 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"); }