Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Bug 4035: Fixed some sonar / findbugs issues in DOM MD-SAL.
[controller.git]
/
opendaylight
/
md-sal
/
sal-dom-broker
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
md
/
sal
/
dom
/
broker
/
impl
/
CommitCoordinationTask.java
diff --git
a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/CommitCoordinationTask.java
b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/CommitCoordinationTask.java
index a644f4d28369fd52d5cc9c8509dcf290c79c6acf..da7a0d19f0a8df00810dc5ec641359c71cdadc35 100644
(file)
--- a/
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/CommitCoordinationTask.java
+++ b/
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/CommitCoordinationTask.java
@@
-31,7
+31,7
@@
final class CommitCoordinationTask implements Callable<Void> {
canCommit,
preCommit,
doCommit,
canCommit,
preCommit,
doCommit,
- }
;
+ }
private static final Logger LOG = LoggerFactory.getLogger(CommitCoordinationTask.class);
private final Collection<DOMStoreThreePhaseCommitCohort> cohorts;
private static final Logger LOG = LoggerFactory.getLogger(CommitCoordinationTask.class);
private final Collection<DOMStoreThreePhaseCommitCohort> cohorts;
@@
-66,7
+66,7
@@
final class CommitCoordinationTask implements Callable<Void> {
LOG.debug("Transaction {}: doCommit completed", tx.getIdentifier());
return null;
LOG.debug("Transaction {}: doCommit completed", tx.getIdentifier());
return null;
- } catch (TransactionCommitFailedException e) {
+ } catch (
final
TransactionCommitFailedException e) {
LOG.warn("Tx: {} Error during phase {}, starting Abort", tx.getIdentifier(), phase, e);
abortBlocking(e);
throw e;
LOG.warn("Tx: {} Error during phase {}, starting Abort", tx.getIdentifier(), phase, e);
abortBlocking(e);
throw e;
@@
-90,7
+90,7
@@
final class CommitCoordinationTask implements Callable<Void> {
*
*/
private void canCommitBlocking() throws TransactionCommitFailedException {
*
*/
private void canCommitBlocking() throws TransactionCommitFailedException {
- for (ListenableFuture<?> canCommit : canCommitAll()) {
+ for (
final
ListenableFuture<?> canCommit : canCommitAll()) {
try {
final Boolean result = (Boolean)canCommit.get();
if (result == null || !result) {
try {
final Boolean result = (Boolean)canCommit.get();
if (result == null || !result) {
@@
-117,7
+117,7
@@
final class CommitCoordinationTask implements Callable<Void> {
private ListenableFuture<?>[] canCommitAll() {
final ListenableFuture<?>[] ops = new ListenableFuture<?>[cohorts.size()];
int i = 0;
private ListenableFuture<?>[] canCommitAll() {
final ListenableFuture<?>[] ops = new ListenableFuture<?>[cohorts.size()];
int i = 0;
- for (DOMStoreThreePhaseCommitCohort cohort : cohorts) {
+ for (
final
DOMStoreThreePhaseCommitCohort cohort : cohorts) {
ops[i++] = cohort.canCommit();
}
return ops;
ops[i++] = cohort.canCommit();
}
return ops;
@@
-139,7
+139,7
@@
final class CommitCoordinationTask implements Callable<Void> {
private void preCommitBlocking() throws TransactionCommitFailedException {
final ListenableFuture<?>[] preCommitFutures = preCommitAll();
try {
private void preCommitBlocking() throws TransactionCommitFailedException {
final ListenableFuture<?>[] preCommitFutures = preCommitAll();
try {
- for(ListenableFuture<?> future : preCommitFutures) {
+ for(
final
ListenableFuture<?> future : preCommitFutures) {
future.get();
}
} catch (InterruptedException | ExecutionException e) {
future.get();
}
} catch (InterruptedException | ExecutionException e) {
@@
-164,7
+164,7
@@
final class CommitCoordinationTask implements Callable<Void> {
private ListenableFuture<?>[] preCommitAll() {
final ListenableFuture<?>[] ops = new ListenableFuture<?>[cohorts.size()];
int i = 0;
private ListenableFuture<?>[] preCommitAll() {
final ListenableFuture<?>[] ops = new ListenableFuture<?>[cohorts.size()];
int i = 0;
- for (DOMStoreThreePhaseCommitCohort cohort : cohorts) {
+ for (
final
DOMStoreThreePhaseCommitCohort cohort : cohorts) {
ops[i++] = cohort.preCommit();
}
return ops;
ops[i++] = cohort.preCommit();
}
return ops;
@@
-185,7
+185,7
@@
final class CommitCoordinationTask implements Callable<Void> {
private void commitBlocking() throws TransactionCommitFailedException {
final ListenableFuture<?>[] commitFutures = commitAll();
try {
private void commitBlocking() throws TransactionCommitFailedException {
final ListenableFuture<?>[] commitFutures = commitAll();
try {
- for(ListenableFuture<?> future : commitFutures) {
+ for(
final
ListenableFuture<?> future : commitFutures) {
future.get();
}
} catch (InterruptedException | ExecutionException e) {
future.get();
}
} catch (InterruptedException | ExecutionException e) {
@@
-207,7
+207,7
@@
final class CommitCoordinationTask implements Callable<Void> {
private ListenableFuture<?>[] commitAll() {
final ListenableFuture<?>[] ops = new ListenableFuture<?>[cohorts.size()];
int i = 0;
private ListenableFuture<?>[] commitAll() {
final ListenableFuture<?>[] ops = new ListenableFuture<?>[cohorts.size()];
int i = 0;
- for (DOMStoreThreePhaseCommitCohort cohort : cohorts) {
+ for (
final
DOMStoreThreePhaseCommitCohort cohort : cohorts) {
ops[i++] = cohort.commit();
}
return ops;
ops[i++] = cohort.commit();
}
return ops;
@@
-254,11
+254,12
@@
final class CommitCoordinationTask implements Callable<Void> {
* @return Future which will complete once all cohorts completed
* abort.
*/
* @return Future which will complete once all cohorts completed
* abort.
*/
+ @SuppressWarnings({"unchecked", "rawtypes"})
private ListenableFuture<Void> abortAsyncAll() {
final ListenableFuture<?>[] ops = new ListenableFuture<?>[cohorts.size()];
int i = 0;
private ListenableFuture<Void> abortAsyncAll() {
final ListenableFuture<?>[] ops = new ListenableFuture<?>[cohorts.size()];
int i = 0;
- for (DOMStoreThreePhaseCommitCohort cohort : cohorts) {
+ for (
final
DOMStoreThreePhaseCommitCohort cohort : cohorts) {
ops[i++] = cohort.abort();
}
ops[i++] = cohort.abort();
}
@@
-267,8
+268,6
@@
final class CommitCoordinationTask implements Callable<Void> {
* order to fail composite future if any of them failed.
* See Futures.allAsList for this description.
*/
* order to fail composite future if any of them failed.
* See Futures.allAsList for this description.
*/
- @SuppressWarnings({ "unchecked", "rawtypes" })
- ListenableFuture<Void> compositeResult = (ListenableFuture) Futures.allAsList(ops);
- return compositeResult;
+ return (ListenableFuture) Futures.allAsList(ops);
}
}
}
}