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%2FShardReadTransaction.java;h=9d8f57252a2fc43bd316f213c9f8b68f4f4c453f;hb=9f19da6634f18ab4d55ca1def76566ca63416ff0;hp=f78935b5e72b6c79070efe5b8cbd315fa535ac12;hpb=5c7fe226016d6997f411601502589e86ad9d8f87;p=controller.git 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 f78935b5e7..9d8f57252a 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,33 +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, + int txnClientVersion) { + super(shardActor, schemaContext, shardStats, transactionID, txnClientVersion); + 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()); - } + @Override + protected DOMStoreTransaction getDOMStoreTransaction() { + return transaction; + } }