How to check that Zookeeper server is started using Curator?

stikku

For my tests I am using a test Zookeeper server but I would like to be able to wait until the server is fully started (since I am starting it as part of the test init process).

How is it possible to cleanly check that a (Test) Zookeeper server is correctly started using Curator? Some form of ping/etc?

stikku

I managed to find the answer and wanted to share.

Curator has a method blockUntilConnected which will wait until it gets a connection from Zookeeper.

CuratorFramework curator = CuratorFrameworkFactory.newClient("localhost:" + TestConstants.TEST_ZOOKEEPER_PORT, new RetryOneTime(100));
curator.start();
curator.blockUntilConnected();

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do I check if a path exists in Zookeeper using Curator?

How to get Stats of a Zookeeper node using Curator framework

Create a ttl node in zookeeper using curator

How to check if a WildFly Server has started successfully using command/script?

Write atomically to multiple zookeeper nodes using Apache Curator Framework?

How to check whether tomcat server is started up

ZooKeeper Recipes and Apache Curator

How to get an event from testServer using curator?

Check how a script was started

How to check programmatically if Zookeeper is running?

Apache Curator ZooKeeper - KeeperErrorCode = Unimplemented for, error

Slow leadership election with apache zookeeper+curator

How to watch for creation of nodes two levels down using Apache Curator?

Using ACL with Curator

How to check if game was started once

How to check if Java is using configured proxy server?

How to check if Image exists on server using URL

How to check condition in then block using SQL Server?

install4j: how can i check whether my apache tomcat server started successfully or not

given a zookeeper server ip:port, how to get the zookeeper structure?

Zookeeper: started but it is probably not running

Using selection strategies with a cache in Curator

Snapshot of elasticsearch using Curator failing

how to run two zookeeper server in one node

Deal with EndOfStreamException from ZooKeeper while Curator's retry attempt?

could not resolve org.apache.zookeeper in curator-framework 2.9.1

zookeeper doen's get started due to java.lang.ClassNotFoundException: org.apache.zookeeper.server.quorum.QuorumPeerMain

How to check if application has started inside container

Python how to check if a thread has already started