Commit 8bc41720 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Make the NodeManager a pseudo singleton object.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1812 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent aa1376f9
...@@ -57,7 +57,7 @@ class Application(object): ...@@ -57,7 +57,7 @@ class Application(object):
# Internal attributes. # Internal attributes.
self.em = EventManager() self.em = EventManager()
self.nm = NodeManager() self.nm = NodeManager
self.name = config.getCluster() self.name = config.getCluster()
self.server = config.getBind() self.server = config.getBind()
......
...@@ -108,7 +108,7 @@ class Application(object): ...@@ -108,7 +108,7 @@ class Application(object):
self.name = name self.name = name
self.connector_handler = getConnectorHandler(connector) self.connector_handler = getConnectorHandler(connector)
self.dispatcher = Dispatcher() self.dispatcher = Dispatcher()
self.nm = NodeManager() self.nm = NodeManager
self.cp = ConnectionPool(self) self.cp = ConnectionPool(self)
self.pt = None self.pt = None
self.master_conn = None self.master_conn = None
......
...@@ -47,7 +47,7 @@ class Application(object): ...@@ -47,7 +47,7 @@ class Application(object):
# Internal attributes. # Internal attributes.
self.em = EventManager() self.em = EventManager()
self.nm = NodeManager() self.nm = NodeManager
self.tm = TransactionManager() self.tm = TransactionManager()
self.name = config.getCluster() self.name = config.getCluster()
......
...@@ -377,3 +377,5 @@ class NodeManager(object): ...@@ -377,3 +377,5 @@ class NodeManager(object):
logging.debug(' * %32s | %8s | %22s | %s' % ( logging.debug(' * %32s | %8s | %22s | %s' % (
uuid, node.getType(), address, node.getState())) uuid, node.getType(), address, node.getState()))
# pseudo singleton
NodeManager = NodeManager()
...@@ -46,7 +46,7 @@ class Application(object): ...@@ -46,7 +46,7 @@ class Application(object):
# Internal attributes. # Internal attributes.
self.em = EventManager() self.em = EventManager()
self.nm = NodeManager() self.nm = NodeManager
self.tm = TransactionManager(self) self.tm = TransactionManager(self)
self.dm = buildDatabaseManager(config.getAdapter(), config.getDatabase()) self.dm = buildDatabaseManager(config.getAdapter(), config.getDatabase())
......
...@@ -125,7 +125,7 @@ class NodesTests(NeoTestBase): ...@@ -125,7 +125,7 @@ class NodesTests(NeoTestBase):
class NodeManagerTests(NeoTestBase): class NodeManagerTests(NeoTestBase):
def setUp(self): def setUp(self):
self.manager = nm = NodeManager() self.manager = nm = NodeManager.__class__()
self.storage = StorageNode(nm, ('127.0.0.1', 1000), self.getNewUUID()) self.storage = StorageNode(nm, ('127.0.0.1', 1000), self.getNewUUID())
self.master = MasterNode(nm, ('127.0.0.1', 2000), self.getNewUUID()) self.master = MasterNode(nm, ('127.0.0.1', 2000), self.getNewUUID())
self.client = ClientNode(nm, None, self.getNewUUID()) self.client = ClientNode(nm, None, self.getNewUUID())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment