summaryrefslogtreecommitdiff
path: root/kazoo/recipe
diff options
context:
space:
mode:
authorJiangge Zhang <tonyseek@gmail.com>2017-04-17 14:54:06 +0800
committerJiangge Zhang <tonyseek@gmail.com>2017-04-17 15:51:34 +0800
commite5cb097582e77094cd5fb8f034e803f9be0f2c0d (patch)
tree228973de24fa14ffcc7b5652a16b5960c41f1acf /kazoo/recipe
parentf1b7edf0511023ad071151737cd262c9d7dbaa76 (diff)
downloadkazoo-e5cb097582e77094cd5fb8f034e803f9be0f2c0d.tar.gz
Closed tree cache could not be started again
Diffstat (limited to 'kazoo/recipe')
-rw-r--r--kazoo/recipe/cache.py5
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.