LZD-PratyushBhatt commented on code in PR #3052:
URL: https://github.com/apache/helix/pull/3052#discussion_r2191380415


##########
helix-core/src/main/java/org/apache/helix/participant/DistClusterControllerStateModel.java:
##########
@@ -62,7 +65,7 @@ public void onBecomeLeaderFromStandby(Message message, 
NotificationContext conte
 
     logger.info(controllerName + " becoming leader from standby for " + 
clusterName);
 
-    synchronized (_controllerOpt) {
+    synchronized (_controllerLock) {

Review Comment:
   Appreciate the suggestion @junkaixue, that’s a fair point. I agree that 
synchronized at method level on this would technically provide mutual exclusion 
in this case.
   
   I opted for a dedicated lock object (_controllerLock) to keep the 
synchronization scope narrowly focused on controller lifecycle transitions, and 
also I didnt want to change the already implemented dedicated lock logic. This 
makes the locking intent more explicit and avoids potential contention if other 
unrelated synchronized methods are ever added to this class (either now or 
later, or lets say by mistake).



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


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

Reply via email to