Demogorgon314 commented on code in PR #22824:
URL: https://github.com/apache/pulsar/pull/22824#discussion_r1629000711


##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java:
##########
@@ -2444,17 +2444,60 @@ The max allowed delay for delayed delivery (in 
milliseconds). If the broker rece
     @FieldContext(
             dynamic = true,
             category = CATEGORY_LOAD_BALANCER,
-            doc = "BandwithIn Resource Usage Weight"
+            doc = "BandwidthIn Resource Usage Weight"
+    )
+    private double loadBalancerBandwidthInResourceWeight = 1.0;
+
+    @FieldContext(
+            dynamic = true,
+            category = CATEGORY_LOAD_BALANCER,
+            doc = "BandwidthOut Resource Usage Weight"
+    )
+    private double loadBalancerBandwidthOutResourceWeight = 1.0;
+
+    @Deprecated
+    @FieldContext(
+            dynamic = true,
+            category = CATEGORY_LOAD_BALANCER,
+            doc = "BandwidthIn Resource Usage Weight, Deprecated: Use 
loadBalancerBandwidthInResourceWeight"
     )
     private double loadBalancerBandwithInResourceWeight = 1.0;
 
+    @Deprecated
     @FieldContext(
             dynamic = true,
             category = CATEGORY_LOAD_BALANCER,
-            doc = "BandwithOut Resource Usage Weight"
+            doc = "BandwidthOut Resource Usage Weight, Deprecated: Use 
loadBalancerBandwidthOutResourceWeight"
     )
     private double loadBalancerBandwithOutResourceWeight = 1.0;
 
+    /**
+     * Get the load balancer bandwidth in resource weight.
+     * To be compatible with the old configuration, we still support the old 
configuration.
+     * If a configuration is not the default configuration, use that 
configuration.
+     * If both the new and the old are configured different from the default 
value, use the new one.
+     * @return
+     */
+    public double getLoadBalancerBandwidthInResourceWeight() {
+        if (loadBalancerBandwidthInResourceWeight != 1.0) {
+            return loadBalancerBandwidthInResourceWeight;
+        } else if (loadBalancerBandwithInResourceWeight != 1.0) {
+            return loadBalancerBandwithInResourceWeight;
+        } else {
+            return 1.0;
+        }

Review Comment:
   ```suggestion
           if (loadBalancerBandwidthInResourceWeight != 1.0) {
               return loadBalancerBandwidthInResourceWeight;
           }
           if (loadBalancerBandwithInResourceWeight != 1.0) {
               return loadBalancerBandwithInResourceWeight;
           }
           return 1.0;
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to