Hi, I often use ZookKeeper in embedded mode, that is to launch both a Server and a Client inside the same JVM. I would like to run the whole setup without the need of network connections.
One use case is to run unit tests which need ZookKeeper, in order to run a full server-client pair at least a listening port is to be opened. Another use case it to run services which depend on ZooKeeper in a single JVM for very small deployments. I use a lot of this kind of services, such as Apache BookKeeper and Apache Kafka which need a working ZookKeeper server to run. Recently I worked on the same issue on BookKeeper https://issues.apache.org/jira/browse/BOOKKEEPER-896 https://issues.apache.org/jira/browse/BOOKKEEPER-930 On 3.5.2 branch ZookKeeper uses Netty and I see that it would be very easy to implement the use of "Local" netty channels, as we did on BookKeeper. The idea is to make ZookKeeper Server listen on a Local Netty Channel and the ZooKeeper client upon channel connection can check if the server is running on the same JVM (using a shared static registry), in this case a local Netty channel is opened instead of the real network channel. As this function is transparent to the client (no configuration option is needed, at least at client side) every existing library which uses standard Java ZooKeeper client will benefit from this improvement. I have already tried to override/rewrite Netty classes and use only configuration options to switch to custom factories but there is a bunch of issues, the main problem is that using the Local Netty Channel you are not using "InetSocketAddress" but "LocalAddress" That do you think ? If is it OK I can create a JIRA and submit a patch against the 3.5 branch or the trunk Thank you Enrico
