summaryrefslogtreecommitdiffstats
path: root/openstack/common
diff options
context:
space:
mode:
authorSteven Hardy <shardy@redhat.com>2013-01-16 15:51:47 +0000
committerSteven Hardy <shardy@redhat.com>2013-01-16 15:51:47 +0000
commit943907790ce804df7ba94f523115099bc961a2b4 (patch)
tree2fcd02129bd03e9669b7e43c5a96b691499b22f4 /openstack/common
parent3eb1c8736186012f62b008b8e823942f345f70aa (diff)
downloadoslo-943907790ce804df7ba94f523115099bc961a2b4.tar.gz
oslo-943907790ce804df7ba94f523115099bc961a2b4.tar.xz
oslo-943907790ce804df7ba94f523115099bc961a2b4.zip
ThreadGroup remove unused name parameters
Thread/ThreadGroup constructors take a name parameter which is never used, so we can simplify things a bit by removing it. If anything is referencing the internal self.name it should be using its own name->threadgroup mapping (e.g via a dict or similar container class) Change-Id: I6877a2fcee60ce9fc087d38aa492d7c9d50ce97e Signed-off-by: Steven Hardy <shardy@redhat.com>
Diffstat (limited to 'openstack/common')
-rw-r--r--openstack/common/service.py4
-rw-r--r--openstack/common/threadgroup.py8
2 files changed, 5 insertions, 7 deletions
diff --git a/openstack/common/service.py b/openstack/common/service.py
index 6b180aa..48aeb9d 100644
--- a/openstack/common/service.py
+++ b/openstack/common/service.py
@@ -51,7 +51,7 @@ class Launcher(object):
:returns: None
"""
- self._services = threadgroup.ThreadGroup('launcher')
+ self._services = threadgroup.ThreadGroup()
eventlet_backdoor.initialize_if_enabled()
@staticmethod
@@ -310,7 +310,7 @@ class Service(object):
"""Service object for binaries running on hosts."""
def __init__(self, threads=1000):
- self.tg = threadgroup.ThreadGroup('service', threads)
+ self.tg = threadgroup.ThreadGroup(threads)
def start(self):
pass
diff --git a/openstack/common/threadgroup.py b/openstack/common/threadgroup.py
index 1f80fef..a87497f 100644
--- a/openstack/common/threadgroup.py
+++ b/openstack/common/threadgroup.py
@@ -38,8 +38,7 @@ class Thread(object):
:class:`ThreadGroup`. The Thread will notify the :class:`ThreadGroup` when
it has done so it can be removed from the threads list.
"""
- def __init__(self, name, thread, group):
- self.name = name
+ def __init__(self, thread, group):
self.thread = thread
self.thread.link(_thread_done, group=group, thread=self)
@@ -57,8 +56,7 @@ class ThreadGroup(object):
when need be).
* provide an easy API to add timers.
"""
- def __init__(self, name, thread_pool_size=10):
- self.name = name
+ def __init__(self, thread_pool_size=10):
self.pool = greenpool.GreenPool(thread_pool_size)
self.threads = []
self.timers = []
@@ -72,7 +70,7 @@ class ThreadGroup(object):
def add_thread(self, callback, *args, **kwargs):
gt = self.pool.spawn(callback, *args, **kwargs)
- th = Thread(callback.__name__, gt, self)
+ th = Thread(gt, self)
self.threads.append(th)
def thread_done(self, thread):