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%2FShard.java;h=43a9faa3e44e5d6fe77db7cce74929f8888dcadb;hp=abcde747b93b132f8c492f25ac8af43f96c84a26;hb=be324821e7ef3dba64375e74b920b7ab513c42e3;hpb=945a63ae76181f7cda4b052fa8fcdf115da4cf2d diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java index abcde747b9..43a9faa3e4 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java @@ -96,16 +96,17 @@ public class Shard extends RaftActor { private final List dataChangeListeners = new ArrayList<>(); - private final ShardContext shardContext; + private final DatastoreContext datastoreContext; + private SchemaContext schemaContext; private Shard(ShardIdentifier name, Map peerAddresses, - ShardContext shardContext) { + DatastoreContext datastoreContext) { super(name.toString(), mapPeerAddresses(peerAddresses), Optional.of(configParams)); this.name = name; - this.shardContext = shardContext; + this.datastoreContext = datastoreContext; String setting = System.getProperty("shard.persistent"); @@ -114,10 +115,11 @@ public class Shard extends RaftActor { LOG.info("Shard created : {} persistent : {}", name, persistent); store = InMemoryDOMDataStoreFactory.create(name.toString(), null, - shardContext.getDataStoreProperties()); + datastoreContext.getDataStoreProperties()); shardMBean = ShardMBeanFactory.getShardStatsMBean(name.toString()); + } private static Map mapPeerAddresses( @@ -134,12 +136,12 @@ public class Shard extends RaftActor { public static Props props(final ShardIdentifier name, final Map peerAddresses, - ShardContext shardContext) { + DatastoreContext datastoreContext) { Preconditions.checkNotNull(name, "name should not be null"); Preconditions.checkNotNull(peerAddresses, "peerAddresses should not be null"); - Preconditions.checkNotNull(shardContext, "shardContext should not be null"); + Preconditions.checkNotNull(datastoreContext, "shardContext should not be null"); - return Props.create(new ShardCreator(name, peerAddresses, shardContext)); + return Props.create(new ShardCreator(name, peerAddresses, datastoreContext)); } @Override public void onReceiveCommand(Object message) { @@ -185,7 +187,7 @@ public class Shard extends RaftActor { return getContext().actorOf( ShardTransaction.props(store.newReadOnlyTransaction(), getSelf(), - schemaContext, shardContext), transactionId.toString()); + schemaContext,datastoreContext, name.toString()), transactionId.toString()); } else if (createTransaction.getTransactionType() == TransactionProxy.TransactionType.READ_WRITE.ordinal()) { @@ -194,7 +196,7 @@ public class Shard extends RaftActor { return getContext().actorOf( ShardTransaction.props(store.newReadWriteTransaction(), getSelf(), - schemaContext, shardContext), transactionId.toString()); + schemaContext, datastoreContext,name.toString()), transactionId.toString()); } else if (createTransaction.getTransactionType() @@ -204,7 +206,7 @@ public class Shard extends RaftActor { return getContext().actorOf( ShardTransaction.props(store.newWriteOnlyTransaction(), getSelf(), - schemaContext, shardContext), transactionId.toString()); + schemaContext, datastoreContext, name.toString()), transactionId.toString()); } else { throw new IllegalArgumentException( "Shard="+name + ":CreateTransaction message has unidentified transaction type=" @@ -343,7 +345,7 @@ public class Shard extends RaftActor { private void createTransactionChain() { DOMStoreTransactionChain chain = store.createTransactionChain(); ActorRef transactionChain = getContext().actorOf( - ShardTransactionChain.props(chain, schemaContext, shardContext)); + ShardTransactionChain.props(chain, schemaContext, datastoreContext,name.toString() )); getSender().tell(new CreateTransactionChainReply(transactionChain.path()).toSerializable(), getSelf()); } @@ -423,18 +425,18 @@ public class Shard extends RaftActor { final ShardIdentifier name; final Map peerAddresses; - final ShardContext shardContext; + final DatastoreContext datastoreContext; ShardCreator(ShardIdentifier name, Map peerAddresses, - ShardContext shardContext) { + DatastoreContext datastoreContext) { this.name = name; this.peerAddresses = peerAddresses; - this.shardContext = shardContext; + this.datastoreContext = datastoreContext; } @Override public Shard create() throws Exception { - return new Shard(name, peerAddresses, shardContext); + return new Shard(name, peerAddresses, datastoreContext); } } }