We want to introduce a new API to boot a ZooKeeper server node from Java.
Currently (up to 3.6.1) we are distributing a tarball that contains binaries and bash scripts to launch the server.
We are also deploying to Maven central the zookeeper-server jar that contains the server side code together with the java client code.
People are used to use that Jar to start the ZooKeeper server inside a Java process.
Two use cases:
- run tests of applications based on ZooKeeper (like Curator TestingServer)
- launch ZooKeeper with some Java based process management system
Currently such applications that want to run ZooKeeper server use internal code, in the most fancy ways, in order to setup something that 'works'.
This is very error prone because ZooKeeper server internals change from version to version, because the only contracts are the configuration file format and the wire protocols (client-server and server-server).
With this new feature we want to define a stable API that allows:
- to configure and start a ZooKeeper server (standalone or cluster)
- stop it gracefully (even if the suggested way to stop ZooKeeper is to use "kill -9")
- check that the server is alive
- configure the MetricsProvider instance to use (in order to integrate better with the metrics system provided by the runtime environment)
The configuration will be passed as a java.util.Properties object or a Java File (or Path) object.
We are going to create a wrapper around ZooKeeperMain and other classes.
ZooKeeper bootstrap code is already used in many fancy ways, the less we change it the better it is for the sake of stability.
In is out of scope to support Java applications that embed ZooKeeper server and use the ZooKeeper client, this is not a good idea and it must not be suggested.