Use primitive boolean because of being synchronized already
Change-Id: Ie9d454fe03a92a9f865d45882de5749f55f2f2f9
Showing
1 changed file
with
3 additions
and
4 deletions
... | @@ -74,7 +74,6 @@ import java.util.Set; | ... | @@ -74,7 +74,6 @@ import java.util.Set; |
74 | import java.util.concurrent.ConcurrentHashMap; | 74 | import java.util.concurrent.ConcurrentHashMap; |
75 | import java.util.concurrent.ExecutorService; | 75 | import java.util.concurrent.ExecutorService; |
76 | import java.util.concurrent.Executors; | 76 | import java.util.concurrent.Executors; |
77 | -import java.util.concurrent.atomic.AtomicBoolean; | ||
78 | 77 | ||
79 | import static com.google.common.base.Preconditions.checkNotNull; | 78 | import static com.google.common.base.Preconditions.checkNotNull; |
80 | import static com.google.common.base.Strings.isNullOrEmpty; | 79 | import static com.google.common.base.Strings.isNullOrEmpty; |
... | @@ -598,7 +597,7 @@ public class FlowRuleManager | ... | @@ -598,7 +597,7 @@ public class FlowRuleManager |
598 | private final List<Set<FlowRuleOperation>> stages; | 597 | private final List<Set<FlowRuleOperation>> stages; |
599 | private final FlowRuleOperationsContext context; | 598 | private final FlowRuleOperationsContext context; |
600 | private final FlowRuleOperations fops; | 599 | private final FlowRuleOperations fops; |
601 | - private final AtomicBoolean hasFailed = new AtomicBoolean(false); | 600 | + private boolean hasFailed = false; |
602 | 601 | ||
603 | private final Set<DeviceId> pendingDevices = new HashSet<>(); | 602 | private final Set<DeviceId> pendingDevices = new HashSet<>(); |
604 | 603 | ||
... | @@ -612,7 +611,7 @@ public class FlowRuleManager | ... | @@ -612,7 +611,7 @@ public class FlowRuleManager |
612 | public synchronized void run() { | 611 | public synchronized void run() { |
613 | if (stages.size() > 0) { | 612 | if (stages.size() > 0) { |
614 | process(stages.remove(0)); | 613 | process(stages.remove(0)); |
615 | - } else if (!hasFailed.get() && context != null) { | 614 | + } else if (!hasFailed && context != null) { |
616 | context.onSuccess(fops); | 615 | context.onSuccess(fops); |
617 | } | 616 | } |
618 | } | 617 | } |
... | @@ -664,7 +663,7 @@ public class FlowRuleManager | ... | @@ -664,7 +663,7 @@ public class FlowRuleManager |
664 | 663 | ||
665 | 664 | ||
666 | synchronized void fail(DeviceId devId, Set<? extends FlowRule> failures) { | 665 | synchronized void fail(DeviceId devId, Set<? extends FlowRule> failures) { |
667 | - hasFailed.set(true); | 666 | + hasFailed = true; |
668 | pendingDevices.remove(devId); | 667 | pendingDevices.remove(devId); |
669 | if (pendingDevices.isEmpty()) { | 668 | if (pendingDevices.isEmpty()) { |
670 | operationsService.execute(this); | 669 | operationsService.execute(this); | ... | ... |
-
Please register or login to post a comment