3 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
11 package org.opendaylight.controller.cluster.datastore;
13 import akka.actor.ActorRef;
15 import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardStats;
16 import org.opendaylight.controller.cluster.datastore.messages.DataExists;
17 import org.opendaylight.controller.cluster.datastore.messages.ReadData;
18 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
19 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
25 public class ShardReadWriteTransaction extends ShardWriteTransaction {
26 private final DOMStoreReadWriteTransaction transaction;
28 public ShardReadWriteTransaction(DOMStoreReadWriteTransaction transaction, ActorRef shardActor,
29 SchemaContext schemaContext, ShardStats shardStats, String transactionID,
30 int txnClientVersion) {
31 super(transaction, shardActor, schemaContext, shardStats, transactionID, txnClientVersion);
32 this.transaction = transaction;
36 public void handleReceive(Object message) throws Exception {
37 if (message instanceof ReadData) {
38 readData(transaction, (ReadData) message, !SERIALIZED_REPLY);
40 } else if (message instanceof DataExists) {
41 dataExists(transaction, (DataExists) message, !SERIALIZED_REPLY);
43 } else if(ReadData.SERIALIZABLE_CLASS.equals(message.getClass())) {
44 readData(transaction, ReadData.fromSerializable(message), SERIALIZED_REPLY);
46 } else if(DataExists.SERIALIZABLE_CLASS.equals(message.getClass())) {
47 dataExists(transaction, DataExists.fromSerializable(message), SERIALIZED_REPLY);
50 super.handleReceive(message);