BUG-7033: Follow-up to address prior comments
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / ShardDataTree.java
index 9d65d993bbf5c2484ec66b417a558ac02ae413f9..31198b98f2541c1e2cf1684d292e076d2edc90d3 100644 (file)
@@ -537,8 +537,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
     }
 
     public Collection<ShardDataTreeCohort> getAndClearPendingTransactions() {
-        Collection<ShardDataTreeCohort> ret = new ArrayList<>(pendingTransactions.size() + pendingCommits.size()
-                + pendingFinishCommits.size());
+        Collection<ShardDataTreeCohort> ret = new ArrayList<>(getQueueSize());
 
         for (CommitEntry entry: pendingFinishCommits) {
             ret.add(entry.cohort);
@@ -908,7 +907,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
 
                 return true;
             } else {
-                newTip = MoreObjects.firstNonNull(e.cohort.getCandidate(), dataTree);
+                newTip = MoreObjects.firstNonNull(e.cohort.getCandidate(), newTip);
             }
         }