Fix FindBugs warnings in sal-distributed-datastore and enable enforcement
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / ThreePhaseCommitCohortProxy.java
index 17017b9b668ea699d1dab0ecfa7deac2448c84b4..8f6271605727abba421dafd8bb9dee3a070bdd0c 100644 (file)
@@ -87,11 +87,12 @@ public class ThreePhaseCommitCohortProxy extends AbstractThreePhaseCommitCohort<
         }
 
         final AtomicInteger completed = new AtomicInteger(cohorts.size());
+        final Object lock = new Object();
         for (final CohortInfo info: cohorts) {
             info.getActorFuture().onComplete(new OnComplete<ActorSelection>() {
                 @Override
                 public void onComplete(Throwable failure, ActorSelection actor)  {
-                    synchronized (completed) {
+                    synchronized (lock) {
                         boolean done = completed.decrementAndGet() == 0;
                         if (failure != null) {
                             LOG.debug("Tx {}: a cohort Future failed", transactionId, failure);