jira-importer commented on issue #574:
URL: https://github.com/apache/curator/issues/574#issuecomment-2604699021

   <i><a 
href="https://issues.apache.org/jira/secure/ViewProfile.jspa?name=evaristojo...@yahoo.es";>evaristojo...@yahoo.es</a>:</i>
   <p>I have test the new implementation and I think there is an issue with the 
ConnectionStateListener of the CuratorFramework used in the recipe</p>
   
   <p>This sequence is not working (The problem is that the 
ConnectionStateListener is triggered as CONNECTED even when the ZK server is 
stopped, and this related with the start of the PersistentEphemeralNode 
instance)</p>
   
   <p>// ZK servers are not started here<br/>
   ExponentialBackoffRetry retryPolicy = new ExponentialBackoffRetry(1000, 1, 
2000);<br/>
   CuratorFramework zkClient = 
CuratorFrameworkFactory.newClient("127.0.0.1:30101", </p>
   
   <p>4500,<br/>
   4500,<br/>
   retryPolicy);</p>
   
   <p>// Added Connection State Listener<br/>
   ConnectionStateListener listener = new ConnectionStateListener() {</p>
   
   <p>                  @Override<br/>
                        public void stateChanged(CuratorFramework client, 
ConnectionState state) </p>
   {
                                System.out.println("new state" + state);
                        }
   <p>          };<br/>
                zkClient.getConnectionStateListenable().addListener(listener 
);</p>
   
   <p>zkClient.start();<br/>
   Thread.sleep(2000);<br/>
   PersistentEphemeralNode pen = new PersistentEphemeralNode(zkClient, 
Mode.EPHEMERAL, "/abc/pen", "hello".getBytes());<br/>
   pen.start();</p>
   
   <p>// HERE YOU CAN SEE THE MESSAGE PRINTED BY THE ConnectionStateListener AS 
CONNECTED (BUT THAT IT IS NOT POSSIBLE BECAUSE THE SERVER IT IS STILL 
STOPPED)</p>
   
   
   <p>Thread.sleep(100000);</p>
   
   <p>// Start ZK servers here<br/>
   Thread.sleep(2000);<br/>
   // "/abc/pen" ephemeral node is not created</p>
   
   <p>It is expected that once the CuratorFrameowrk is connected the ephemeral 
node is created</p>
   
   <p>I attach a program that shows the failure</p>


-- 
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: dev-unsubscr...@curator.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to