jiajunwang commented on a change in pull request #924: WIP: fix 
ZkHelixPropertyStore loses Zookeeper notification issue
URL: https://github.com/apache/helix/pull/924#discussion_r401918194
 
 

 ##########
 File path: helix-core/src/test/java/org/apache/helix/ZkTestHelper.java
 ##########
 @@ -146,6 +146,70 @@ public void process(WatchedEvent event) {
     LOG.info("After expiry. sessionId: " + 
Long.toHexString(curZookeeper.getSessionId()));
   }
 
+  public static void expireSharedZkClientSession(HelixZkClient client) throws 
Exception {
+    final CountDownLatch waitExpireSession = new CountDownLatch(1);
+    final ZkClient zkClient = (ZkClient) client;
+
+    IZkStateListener listener = new IZkStateListener() {
+      @Override
+      public void handleStateChanged(KeeperState state) throws Exception {
+        LOG.info("IZkStateListener#handleStateChanged, state: " + state);
+        if (state == KeeperState.Expired) {
+          waitExpireSession.countDown();
 
 Review comment:
   I guess this wait only check if there is an expiring happened. The original 
wait is to ensure the session has been re-established. So if you want to 
achieve the same goal, maybe we need to compare the older session and newer 
session then end the wait.
   Given that saying, I guess you can just modify the existing method to 
include this check. Note that if this not happen, we can directly fail the test 
by throwing an exception.

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


With regards,
Apache Git Services

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

Reply via email to