diff --git a/d2/src/main/java/com/linkedin/d2/balancer/servers/ZooKeeperAnnouncer.java b/d2/src/main/java/com/linkedin/d2/balancer/servers/ZooKeeperAnnouncer.java index 315727a6d..78fbfb0b4 100644 --- a/d2/src/main/java/com/linkedin/d2/balancer/servers/ZooKeeperAnnouncer.java +++ b/d2/src/main/java/com/linkedin/d2/balancer/servers/ZooKeeperAnnouncer.java @@ -110,7 +110,7 @@ public class ZooKeeperAnnouncer implements D2ServiceDiscoveryEventHelper /** * The action to take when d2 weight breaches validation rules. */ - private ActionOnWeightBreach _actionOnWeightBreach = ActionOnWeightBreach.IGNORE; + private final ActionOnWeightBreach _actionOnWeightBreach; private final AtomicInteger _maxWeightBreachedCount = new AtomicInteger(0); private final AtomicInteger _weightDecimalPlacesBreachedCount = new AtomicInteger(0); @@ -267,10 +267,7 @@ public ZooKeeperAnnouncer(LoadBalancerServer server, boolean initialIsUp, _eventEmitter = eventEmitter; _maxWeight = maxWeight; - if (actionOnWeightBreach != null) - { - _actionOnWeightBreach = actionOnWeightBreach; - } + _actionOnWeightBreach = actionOnWeightBreach != null ? actionOnWeightBreach : ActionOnWeightBreach.IGNORE; if (server instanceof ZooKeeperServer) {