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%2FShardReadTransaction.java;h=be9c4d80e311484d0e6edea2050d85a0ebf28d1f;hp=7a18fca100f027b2bfad23b0433eeb91eab06484;hb=37f0504d391efd8b7d61403759fcc22a6dd3a093;hpb=62ee81f764eef592f00e67181b4dbedb3f734de6 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardReadTransaction.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardReadTransaction.java index 7a18fca100..be9c4d80e3 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardReadTransaction.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardReadTransaction.java @@ -11,14 +11,11 @@ package org.opendaylight.controller.cluster.datastore; import akka.actor.ActorRef; -import akka.actor.PoisonPill; -import akka.event.Logging; -import akka.event.LoggingAdapter; -import org.opendaylight.controller.cluster.datastore.messages.CloseTransaction; -import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionReply; +import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardStats; +import org.opendaylight.controller.cluster.datastore.messages.DataExists; import org.opendaylight.controller.cluster.datastore.messages.ReadData; import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction; -import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain; +import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransaction; import org.opendaylight.yangtools.yang.model.api.SchemaContext; /** @@ -26,38 +23,36 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext; * Date: 8/6/14 */ public class ShardReadTransaction extends ShardTransaction { - private final DOMStoreReadTransaction transaction; - private final LoggingAdapter log = - Logging.getLogger(getContext().system(), this); - - public ShardReadTransaction(DOMStoreReadTransaction transaction, ActorRef shardActor, SchemaContext schemaContext) { - super(shardActor, schemaContext); - this.transaction = transaction; - - } - - public ShardReadTransaction(DOMStoreTransactionChain transactionChain, DOMStoreReadTransaction transaction, ActorRef shardActor, SchemaContext schemaContext) { - super(transactionChain, shardActor, schemaContext); - this.transaction = transaction; - } - - @Override - public void handleReceive(Object message) throws Exception { - if (ReadData.SERIALIZABLE_CLASS.equals(message.getClass())) { - readData(transaction,ReadData.fromSerializable(message)); - } else { - super.handleReceive(message); + private final DOMStoreReadTransaction transaction; + + public ShardReadTransaction(DOMStoreReadTransaction transaction, ActorRef shardActor, + SchemaContext schemaContext, ShardStats shardStats, String transactionID, + short clientTxVersion) { + super(shardActor, schemaContext, shardStats, transactionID, clientTxVersion); + this.transaction = transaction; + } + + @Override + public void handleReceive(Object message) throws Exception { + if(message instanceof ReadData) { + readData(transaction, (ReadData) message, !SERIALIZED_REPLY); + + } else if (message instanceof DataExists) { + dataExists(transaction, (DataExists) message, !SERIALIZED_REPLY); + + } else if(ReadData.SERIALIZABLE_CLASS.equals(message.getClass())) { + readData(transaction, ReadData.fromSerializable(message), SERIALIZED_REPLY); + + } else if(DataExists.SERIALIZABLE_CLASS.equals(message.getClass())) { + dataExists(transaction, DataExists.fromSerializable(message), SERIALIZED_REPLY); + + } else { + super.handleReceive(message); + } } - } - protected void closeTransaction(CloseTransaction message) { - transaction.close(); - getSender().tell(new CloseTransactionReply().toSerializable(), getSelf()); - getSelf().tell(PoisonPill.getInstance(), getSelf()); - } - - //default scope test method to check if we get correct exception - void forUnitTestOnlyExplicitTransactionClose(){ - transaction.close(); - } + @Override + protected DOMStoreTransaction getDOMStoreTransaction() { + return transaction; + } }