Why not have that listener own the CopyOnWriteArraySet<ZooKeeperConnectionListener> listeners set? Either way, doesn't matter. I can merge the PR after some more testing then