summaryrefslogtreecommitdiff
path: root/oslo_messaging/_utils.py
diff options
context:
space:
mode:
authorMatthew Booth <mbooth@redhat.com>2015-10-19 14:11:23 +0100
committerMatthew Booth <mbooth@redhat.com>2015-10-23 16:15:06 +0100
commitd700c382791b6352bb80a0dc455589085881669f (patch)
tree254c1649008c6867e7714f992cb995328b545751 /oslo_messaging/_utils.py
parentb93d20854393fcc660a32760fcf1af7a45e10225 (diff)
downloadoslo-messaging-d700c382791b6352bb80a0dc455589085881669f.tar.gz
Robustify locking in MessageHandlingServer
This change formalises locking in MessageHandlingServer. It allows the user to make calls in any order and it will ensure, with locking, that these will be reordered appropriately. It also adds locking for internal state when using the blocking executor, which closes a number of races. It fixes a regression introduced in change gI3cfbe1bf02d451e379b1dcc23dacb0139c03be76. If multiple threads called wait() simultaneously, only 1 of them would wait and the others would return immediately, despite message handling not having completed. With this change only 1 will call the underlying wait, but all will wait on its completion. We add a common logging mechanism when waiting too long. Specifically, we now log a single message when waiting on any lock for longer than 30 seconds. We remove DummyCondition as it no longer has any users. Change-Id: I9d516b208446963dcd80b75e2d5a2cecb1187efa
Diffstat (limited to 'oslo_messaging/_utils.py')
-rw-r--r--oslo_messaging/_utils.py23
1 files changed, 0 insertions, 23 deletions
diff --git a/oslo_messaging/_utils.py b/oslo_messaging/_utils.py
index 1bb20b0..cec94bb 100644
--- a/oslo_messaging/_utils.py
+++ b/oslo_messaging/_utils.py
@@ -116,29 +116,6 @@ def fetch_current_thread_functor():
return lambda: threading.current_thread()
-class DummyCondition(object):
- def acquire(self):
- pass
-
- def notify(self):
- pass
-
- def notify_all(self):
- pass
-
- def wait(self, timeout=None):
- pass
-
- def release(self):
- pass
-
- def __enter__(self):
- self.acquire()
-
- def __exit__(self, type, value, traceback):
- self.release()
-
-
class DummyLock(object):
def acquire(self):
pass