Github user dragonsinth commented on the pull request:
https://github.com/apache/curator/pull/17#issuecomment-50920900
wasDeleted() can only be called from the watch event / background result
thread, not the connection state listener. It is true it can be called
concurrently from TreeCache.close(), but I believe wasDeleted() is completely
idempotent / concurrency safe.
The first several operations are completely idempotent, it's harmless to
run them multiple times. After that, there's an escape hatch if the tree is
closing (which will have already been set in the TreeCache.close() case).
After THAT, there's a an atomic compare-and-set to publish a delete event,
which only one thread can win. And the remainder of the method is also
idempotent.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---