summaryrefslogtreecommitdiffstats
path: root/openstack/common/local.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-02-06 14:46:50 +0000
committerGerrit Code Review <review@openstack.org>2013-02-06 14:46:50 +0000
commit51bee3c7b53acca108f191a152a3783600d0f51a (patch)
tree47ba93156e93f51fd9ee587a0bcd268acf700136 /openstack/common/local.py
parente7c973ed8d708cf950acb25612b646260bccaca0 (diff)
parent51efba78bdcee821937c28c1973ec80e8c2d59ae (diff)
downloadoslo-51bee3c7b53acca108f191a152a3783600d0f51a.tar.gz
oslo-51bee3c7b53acca108f191a152a3783600d0f51a.tar.xz
oslo-51bee3c7b53acca108f191a152a3783600d0f51a.zip
Merge "Emit a warning if RPC calls made with lock."
Diffstat (limited to 'openstack/common/local.py')
-rw-r--r--openstack/common/local.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/openstack/common/local.py b/openstack/common/local.py
index 19d9627..8bdc837 100644
--- a/openstack/common/local.py
+++ b/openstack/common/local.py
@@ -26,6 +26,9 @@ class WeakLocal(corolocal.local):
def __getattribute__(self, attr):
rval = corolocal.local.__getattribute__(self, attr)
if rval:
+ # NOTE(mikal): this bit is confusing. What is stored is a weak
+ # reference, not the value itself. We therefore need to lookup
+ # the weak reference and return the inner value here.
rval = rval()
return rval
@@ -34,4 +37,12 @@ class WeakLocal(corolocal.local):
return corolocal.local.__setattr__(self, attr, value)
+# NOTE(mikal): the name "store" should be deprecated in the future
store = WeakLocal()
+
+# A "weak" store uses weak references and allows an object to fall out of scope
+# when it falls out of scope in the code that uses the thread local storage. A
+# "strong" store will hold a reference to the object so that it never falls out
+# of scope.
+weak_store = WeakLocal()
+strong_store = corolocal.local