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%2FShardDataTree.java;h=bc9549a64071649daf33ee06e66a2a78dcd0511e;hp=5b015ead9acee3034600a86c6bad4a93ea4c62b5;hb=ba99b089ca16480dd8b65b814f68e3fd26ab1246;hpb=cd2a6fa0d8fa6281be28d3c7b9828ecf4e932811 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 5b015ead9a..bc9549a640 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 @@ -683,8 +683,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent { return cohort; } - @SuppressFBWarnings(value = {"RV_RETURN_VALUE_IGNORED", "DB_DUPLICATE_SWITCH_CLAUSES"}, - justification = "See inline comments below.") + @SuppressFBWarnings(value = "DB_DUPLICATE_SWITCH_CLAUSES", justification = "See inline comments below.") void checkForExpiredTransactions(final long transactionCommitTimeoutMillis) { final long timeout = TimeUnit.MILLISECONDS.toNanos(transactionCommitTimeoutMillis); final long now = shard.ticker().read(); @@ -695,16 +694,16 @@ public class ShardDataTree extends ShardDataTreeTransactionParent { boolean processNext = true; switch (currentTx.cohort.getState()) { case CAN_COMMIT_PENDING: - pendingTransactions.poll().cohort.failedCanCommit(new TimeoutException()); + pendingTransactions.remove().cohort.failedCanCommit(new TimeoutException()); break; case CAN_COMMIT_COMPLETE: // The suppression of the FindBugs "DB_DUPLICATE_SWITCH_CLAUSES" warning pertains to this clause // whose code is duplicated with PRE_COMMIT_COMPLETE. The clauses aren't combined in case the code // in PRE_COMMIT_COMPLETE is changed. - pendingTransactions.poll().cohort.reportFailure(new TimeoutException()); + pendingTransactions.remove().cohort.reportFailure(new TimeoutException()); break; case PRE_COMMIT_PENDING: - pendingTransactions.poll().cohort.failedPreCommit(new TimeoutException()); + pendingTransactions.remove().cohort.failedPreCommit(new TimeoutException()); break; case PRE_COMMIT_COMPLETE: // FIXME: this is a legacy behavior problem. Three-phase commit protocol specifies that after we @@ -724,7 +723,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent { // In order to make the pre-commit timer working across failovers, though, we need // a per-shard cluster-wide monotonic time, so a follower becoming the leader can accurately // restart the timer. - pendingTransactions.poll().cohort.reportFailure(new TimeoutException()); + pendingTransactions.remove().cohort.reportFailure(new TimeoutException()); break; case COMMIT_PENDING: LOG.warn("{}: Transaction {} is still committing, cannot abort", logContext, @@ -737,10 +736,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent { case FAILED: case READY: default: - // The suppression of the FindBugs "RV_RETURN_VALUE_IGNORED" warning pertains to this line. In - // this case, we just want to drop the current entry that expired and thus ignore the return value. - // In fact we really shouldn't hit this case but we handle all enums for completeness. - pendingTransactions.poll(); + pendingTransactions.remove(); } if (processNext) { @@ -749,7 +745,6 @@ public class ShardDataTree extends ShardDataTreeTransactionParent { } } - @SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED", justification = "See inline comment below.") void startAbort(final SimpleShardDataTreeCohort cohort) { final Iterator it = pendingTransactions.iterator(); if (!it.hasNext()) { @@ -764,10 +759,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent { LOG.debug("{}: aborted head of queue {} in state {}", logContext, cohort.getIdentifier(), cohort.getIdentifier()); - // The suppression of the FindBugs "RV_RETURN_VALUE_IGNORED" warning pertains to this line. In - // this case, we've already obtained the head of the queue above via the Iterator and we just want to - // remove it here. - pendingTransactions.poll(); + pendingTransactions.remove(); processNextTransaction(); } else { LOG.warn("{}: transaction {} is committing, skipping abort", logContext, cohort.getIdentifier());