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=7ad721fc905b0c48353121f664b7a2d520309334;hb=refs%2Fchanges%2F82%2F105182%2F3;hp=65511017ae6448be582ef96152f9b0f60ca60097;hpb=7314a4f99840d76cd0c167d22a588d98faa362a4;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 65511017ae..7ad721fc90 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 @@ -621,22 +621,21 @@ public class ShardDataTree extends ShardDataTreeTransactionParent { final ReadOnlyShardDataTreeTransaction newReadOnlyTransaction(final TransactionIdentifier txId) { shard.getShardMBean().incrementReadOnlyTransactionCount(); - if (txId.getHistoryId().getHistoryId() == 0) { + final var historyId = txId.getHistoryId(); + if (historyId.getHistoryId() == 0) { return new ReadOnlyShardDataTreeTransaction(this, txId, dataTree.takeSnapshot()); } - - return ensureTransactionChain(txId.getHistoryId(), null).newReadOnlyTransaction(txId); + return ensureTransactionChain(historyId, null).newReadOnlyTransaction(txId); } final ReadWriteShardDataTreeTransaction newReadWriteTransaction(final TransactionIdentifier txId) { shard.getShardMBean().incrementReadWriteTransactionCount(); - if (txId.getHistoryId().getHistoryId() == 0) { - return new ReadWriteShardDataTreeTransaction(ShardDataTree.this, txId, dataTree.takeSnapshot() - .newModification()); + final var historyId = txId.getHistoryId(); + if (historyId.getHistoryId() == 0) { + return new ReadWriteShardDataTreeTransaction(this, txId, dataTree.takeSnapshot().newModification()); } - - return ensureTransactionChain(txId.getHistoryId(), null).newReadWriteTransaction(txId); + return ensureTransactionChain(historyId, null).newReadWriteTransaction(txId); } @VisibleForTesting @@ -1184,11 +1183,11 @@ public class ShardDataTree extends ShardDataTreeTransactionParent { // the newReadWriteTransaction() final ShardDataTreeCohort newReadyCohort(final TransactionIdentifier txId, final DataTreeModification mod, final Optional> participatingShardNames) { - if (txId.getHistoryId().getHistoryId() == 0) { + final var historyId = txId.getHistoryId(); + if (historyId.getHistoryId() == 0) { return createReadyCohort(txId, mod, participatingShardNames); } - - return ensureTransactionChain(txId.getHistoryId(), null).createReadyCohort(txId, mod, participatingShardNames); + return ensureTransactionChain(historyId, null).createReadyCohort(txId, mod, participatingShardNames); } @SuppressFBWarnings(value = "DB_DUPLICATE_SWITCH_CLAUSES", justification = "See inline comments below.")