Github user anmolnar commented on the issue:
https://github.com/apache/zookeeper/pull/700
@hanm The issue with Java 11 builds is the refactoring that was made in NIO
from Java 11:
https://www.oracle.com/technetwork/java/javase/11-relnote-issues-5012449.html#JDK-8198562
The key part is:
> Closing a connected SocketChannel that is registered with a Selector will
now consistently delay closing the underlying connection until the closed
channel is flushed from all selectors that it is registered with.
In other words, we have to close all registered Selectors to properly close
the socket. Therefore `tryClose(oldSS)` on its own is not enough.
---