twitter/commons — pull request #191 by pkwarren (2014-01-07 04:57:40+00:00)
Title: Use a CopyOnWriteHashSet to avoid CME.

Switch from a synchronized HashSet to a CopyOnWriteHashSet to avoid
ConcurrentModificationException when processing watchers.

This avoids exceptions like the following:

ERROR org.apache.zookeeper.ClientCnxn: Error while calling watcher
! java.util.ConcurrentModificationException: null
! at java.util.HashMap$HashIterator.nextEntry(Unknown Source)
! at java.util.HashMap$KeyIterator.next(Unknown Source)
! at com.twitter.common.zookeeper.ZooKeeperClient$2.process(
ZooKeeperClient.java:318)
! at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(
ClientCnxn.java:526)