Unsafe publication in client API
Issue Type: Bug
Components: java client
Affects Versions: 3.2.2
Reporter: Martin Traverso
The following code may result in a data race due to unsafe publication of a
reference to "this". The call to cnxn.start() spawns threads that have access
to the partially-constructed reference to the ZooKeeper object.
See http://www.ibm.com/developerworks/java/library/j-jtp0618.html for some
public ZooKeeper(String connectString, int sessionTimeout, Watcher watcher)
cnxn = new ClientCnxn(connectString, sessionTimeout, this,
The obvious fix is to move the call to cnxn.start() into a separate start()
This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.