You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@curator.apache.org by Vitalii Tymchyshyn <vi...@tym.im> on 2014/09/02 20:48:58 UTC

Check if curator is connected.

Hello.

I am trying to find is client is connected at given point of time.

The only option I can see is to call blockUntilConnected(1, NANOSECONDS)
and check result.

What I found is that javadoc is different from the implementation.
According to javadoc blockUntilConnected(0, *) will wait indefinite, but
according to implementation blockUntilConnected(0, NANOSECONDS) will not
wait at all, instead blockUntilConnected(*, null) will wait.

Best regards, Vitalii Tymchyshyn

Re: Check if curator is connected.

Posted by Jordan Zimmerman <jo...@jordanzimmerman.com>.
You can always check the current connection state via:

client.getZookeeperClient().isConnected()


On September 2, 2014 at 1:49:26 PM, Vitalii Tymchyshyn (vit@tym.im) wrote:

Hello.

I am trying to find is client is connected at given point of time.

The only option I can see is to call blockUntilConnected(1, NANOSECONDS) and check result.

What I found is that javadoc is different from the implementation.
According to javadoc blockUntilConnected(0, *) will wait indefinite, but according to implementation blockUntilConnected(0, NANOSECONDS) will not wait at all, instead blockUntilConnected(*, null) will wait.

Best regards, Vitalii Tymchyshyn