diff options
author | Jiangge Zhang <tonyseek@gmail.com> | 2017-04-17 14:54:06 +0800 |
---|---|---|
committer | Jiangge Zhang <tonyseek@gmail.com> | 2017-04-17 15:51:34 +0800 |
commit | e5cb097582e77094cd5fb8f034e803f9be0f2c0d (patch) | |
tree | 228973de24fa14ffcc7b5652a16b5960c41f1acf /kazoo/recipe | |
parent | f1b7edf0511023ad071151737cd262c9d7dbaa76 (diff) | |
download | kazoo-e5cb097582e77094cd5fb8f034e803f9be0f2c0d.tar.gz |
Closed tree cache could not be started again
Diffstat (limited to 'kazoo/recipe')
-rw-r--r-- | kazoo/recipe/cache.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/kazoo/recipe/cache.py b/kazoo/recipe/cache.py index 525154a..bf6b92f 100644 --- a/kazoo/recipe/cache.py +++ b/kazoo/recipe/cache.py @@ -62,6 +62,8 @@ class TreeCache(object): """ if self._state == self.STATE_LATENT: self._state = self.STATE_STARTED + elif self._state == self.STATE_CLOSED: + raise KazooException('already closed') else: raise KazooException('already started') @@ -77,6 +79,9 @@ class TreeCache(object): A closed cache was detached from ZooKeeper's changes. And all nodes will be invalidated. + Once a tree cache was closed, it could not be started again. You should + only close a tree cache while you want to recycle it. + .. note:: This method is not thread safe. |