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%2FShardDataTree.java;h=3e3d4cc20cb070395e75766c25ba95f3ab6eea37;hb=70b20300990b171743d3c7861e60cdde5d60966f;hp=17c3cd82c35e73d0e7ed049b27d4eb25fa52d608;hpb=8ec73bf853a9b6708b455c0321a585992e02b125;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTree.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTree.java index 17c3cd82c3..3e3d4cc20c 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTree.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTree.java @@ -9,12 +9,13 @@ package org.opendaylight.controller.cluster.datastore; import com.google.common.base.Optional; import com.google.common.base.Preconditions; -import com.google.common.base.Strings; import java.util.AbstractMap.SimpleEntry; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import javax.annotation.concurrent.NotThreadSafe; +import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier; +import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener; import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener; @@ -47,7 +48,7 @@ import org.slf4j.LoggerFactory; public class ShardDataTree extends ShardDataTreeTransactionParent { private static final Logger LOG = LoggerFactory.getLogger(ShardDataTree.class); - private final Map transactionChains = new HashMap<>(); + private final Map transactionChains = new HashMap<>(); private final ShardDataTreeChangeListenerPublisher treeChangeListenerPublisher; private final ShardDataChangeListenerPublisher dataChangeListenerPublisher; private final TipProducingDataTree dataTree; @@ -83,31 +84,31 @@ public class ShardDataTree extends ShardDataTreeTransactionParent { dataTree.setSchemaContext(schemaContext); } - private ShardDataTreeTransactionChain ensureTransactionChain(final String chainId) { - ShardDataTreeTransactionChain chain = transactionChains.get(chainId); + private ShardDataTreeTransactionChain ensureTransactionChain(final LocalHistoryIdentifier localHistoryIdentifier) { + ShardDataTreeTransactionChain chain = transactionChains.get(localHistoryIdentifier); if (chain == null) { - chain = new ShardDataTreeTransactionChain(chainId, this); - transactionChains.put(chainId, chain); + chain = new ShardDataTreeTransactionChain(localHistoryIdentifier, this); + transactionChains.put(localHistoryIdentifier, chain); } return chain; } - ReadOnlyShardDataTreeTransaction newReadOnlyTransaction(final String txId, final String chainId) { - if (Strings.isNullOrEmpty(chainId)) { + ReadOnlyShardDataTreeTransaction newReadOnlyTransaction(final TransactionIdentifier txId) { + if (txId.getHistoryId().getHistoryId() == 0) { return new ReadOnlyShardDataTreeTransaction(txId, dataTree.takeSnapshot()); } - return ensureTransactionChain(chainId).newReadOnlyTransaction(txId); + return ensureTransactionChain(txId.getHistoryId()).newReadOnlyTransaction(txId); } - ReadWriteShardDataTreeTransaction newReadWriteTransaction(final String txId, final String chainId) { - if (Strings.isNullOrEmpty(chainId)) { + ReadWriteShardDataTreeTransaction newReadWriteTransaction(final TransactionIdentifier txId) { + if (txId.getHistoryId().getHistoryId() == 0) { return new ReadWriteShardDataTreeTransaction(ShardDataTree.this, txId, dataTree.takeSnapshot() .newModification()); } - return ensureTransactionChain(chainId).newReadWriteTransaction(txId); + return ensureTransactionChain(txId.getHistoryId()).newReadWriteTransaction(txId); } public void notifyListeners(final DataTreeCandidate candidate) { @@ -143,7 +144,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent { transactionChains.clear(); } - void closeTransactionChain(final String transactionChainId) { + void closeTransactionChain(final LocalHistoryIdentifier transactionChainId) { final ShardDataTreeTransactionChain chain = transactionChains.remove(transactionChainId); if (chain != null) { chain.close();