kadirozde commented on code in PR #2274:
URL: https://github.com/apache/phoenix/pull/2274#discussion_r2347803316


##########
phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/HAGroupStoreClient.java:
##########
@@ -638,4 +692,189 @@ private boolean 
isUpdateNeeded(HAGroupStoreRecord.HAGroupState currentHAGroupSta
         return ((System.currentTimeMillis() - currentHAGroupStoreRecordMtime) 
> waitTime);
     }
 
+    // ========== HA Group State Change Subscription Methods ==========
+
+    /**
+     * Subscribe to be notified when a specific state transition occurs.
+     *
+     * @param fromState the state to transition from
+     * @param toState the state to transition to
+     * @param clusterType whether to monitor local or peer cluster
+     * @param listener the listener to notify when the transition occurs
+     */
+    public void subscribeToTransition(HAGroupState fromState, HAGroupState 
toState,

Review Comment:
   I feel that we do not need to complicate matters by having subscriptions at 
the state transition level. I think subscriptions at <toState, clusterType> 
should be good enough. A subscriber does not need to know the details of the 
state transitions as it mostly cares about the target state. Also, subscription 
at the transition level creates coupling between subscribers and the HA state 
machine, which is not necessary. 



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