BUG-7033: Follow-up to address prior comments 89/49689/2
authorTom Pantelis <tpanteli@brocade.com>
Wed, 21 Dec 2016 10:51:39 +0000 (05:51 -0500)
committerTom Pantelis <tpanteli@brocade.com>
Thu, 29 Dec 2016 08:17:53 +0000 (08:17 +0000)
Follow-up patch to address the 2 comments in
https://git.opendaylight.org/gerrit/#/c/49384/ that were made
after merge..

Change-Id: Id9864d89637e72961fc1a259f25d541edb1b46dc
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
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);
             }
         }