eolivelli commented on a change in pull request #11150:
URL: https://github.com/apache/pulsar/pull/11150#discussion_r661280132



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/SimpleLoadManagerImpl.java
##########
@@ -962,10 +966,15 @@ public void accept(Notification n) {
                 log.debug("Received updated load report from broker node - 
[{}], scheduling re-ranking of brokers.",
                         n.getPath());
             }
-            scheduler.submit(this::updateRanking);
+            updateRanking = scheduler.submit(this::updateRanking);
         }
     }
 
+    @VisibleForTesting
+    Future<?> getUpdateRanking(){
+        return updateRanking;

Review comment:
       what about `updateRankingHandle` ?

##########
File path: 
pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/LoadBalancerTest.java
##########
@@ -321,8 +322,11 @@ public void testBrokerRanking() throws Exception {
         }
 
         for (int i = 0; i < BROKER_COUNT; i++) {
-            Method updateRanking = 
Whitebox.getMethod(SimpleLoadManagerImpl.class, "updateRanking");
-            updateRanking.invoke(pulsarServices[i].getLoadManager().get());
+            Method method = Whitebox.getMethod(SimpleLoadManagerImpl.class, 
"getUpdateRanking");
+            Object invoke = 
method.invoke(pulsarServices[i].getLoadManager().get());

Review comment:
       this line should be moved inside the `while` loop
   other wise if `invoke` is null it will be an endless loop

##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/SimpleLoadManagerImpl.java
##########
@@ -962,10 +966,15 @@ public void accept(Notification n) {
                 log.debug("Received updated load report from broker node - 
[{}], scheduling re-ranking of brokers.",
                         n.getPath());
             }
-            scheduler.submit(this::updateRanking);
+            updateRanking = scheduler.submit(this::updateRanking);
         }
     }
 
+    @VisibleForTesting
+    Future<?> getUpdateRanking(){

Review comment:
       you make make this "public" , it is an "Impl" class, it is not public API
   




-- 
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