Author: justi9
Date: 2008-06-02 22:10:01 -0400 (Mon, 02 Jun 2008)
New Revision: 2113
Modified:
mgmt/mint/python/mint/__init__.py
Log:
For bz449706 - Serialize access to the original id dict
Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py 2008-06-03 01:07:24 UTC (rev 2112)
+++ mgmt/mint/python/mint/__init__.py 2008-06-03 02:10:01 UTC (rev 2113)
@@ -121,12 +121,24 @@
class OriginalIdDict:
def __init__(self):
self.idMap = dict()
+ self.lock = Lock()
def set(self, idOriginal, obj):
self.idMap[idOriginal] = obj
-
+
def getByOriginalId(self, objType, idOriginal, managedBroker, create=False, args={}):
obj = None
+
+ self.lock.acquire()
+ try:
+ obj = self.doGetByOriginalId(objType, idOriginal, managedBroker, create, args)
+ finally:
+ self.lock.release()
+
+ return obj
+
+ def doGetByOriginalId(self, objType, idOriginal, managedBroker, create=False,
args={}):
+ obj = None
key = (managedBroker, idOriginal)
if (key in self.idMap):
#print "\n\n=============== %s %d found\n\n" % (objType.__name__,
idOriginal)
Show replies by date