xyuanlu commented on a change in pull request #1456:
URL: https://github.com/apache/helix/pull/1456#discussion_r508876404



##########
File path: 
helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
##########
@@ -333,15 +338,19 @@ private void forceRebalance(HelixManager manager, 
ClusterEventType eventType) {
   void startPeriodRebalance(long period, HelixManager manager) {
     if (period != _timerPeriod) {

Review comment:
       TFTR. I think you are referring to situations like two threads both try 
to change period to a same value. including this compare in the inside critical 
section or not won't have different result. 
   For the case when we change period to different values, the result is 
indeterminable in either way. 
   Please correct m if I am wrong. I think in conclusion, having the compare in 
or out of critical section will have the same behavior. So I prefer smallest  
critical section in this case, especially we have two IOs here. 

##########
File path: 
helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
##########
@@ -172,13 +173,15 @@
   private boolean _inMaintenanceMode;
 
   /**
-   * The timer that can periodically run the rebalancing pipeline. The timer 
will start if there is
-   * one resource group has the config to use the timer.
+   * The executors that can periodically run the rebalancing pipeline. A
+   * SingleThreadScheduledExecutor will start if there is resource group that 
has the config to do
+   * periodically rebalance.
    */
-  Timer _periodicalRebalanceTimer = null;
+  private static final ScheduledExecutorService _periodicalRebalanceExecutor =
+      Executors.newSingleThreadScheduledExecutor();

Review comment:
       Good suggestion. Will update.




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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to