示例#1
0
    def lock_createfunc(self, wait=True):
        if self.funclock is None:
            self.funclock = NameLock(
                identifier="memorycontainer/funclock/%s/%s" %
                (self.namespacemanager.namespace, self.key),
                reentrant=True)

        return self.funclock.acquire(wait)
示例#2
0
class MemoryContainer(Container):

    def do_init(self, **kwargs):
        self.funclock = None
    
    def create_namespace(cls, namespace, **kwargs):
        return MemoryNamespaceManager(namespace, **kwargs)
    create_namespace = classmethod(create_namespace)
        
    def lock_createfunc(self, wait = True): 
        if self.funclock is None:
            self.funclock = NameLock(identifier = "memorycontainer/funclock/%s/%s" % (self.namespacemanager.namespace, self.key), reentrant = True)
            
        return self.funclock.acquire(wait)

    def unlock_createfunc(self): self.funclock.release()
示例#3
0
class MemoryContainer(Container):
    def do_init(self, **kwargs):
        self.funclock = None

    def create_namespace(cls, namespace, **kwargs):
        return MemoryNamespaceManager(namespace, **kwargs)

    create_namespace = classmethod(create_namespace)

    def lock_createfunc(self, wait=True):
        if self.funclock is None:
            self.funclock = NameLock(
                identifier="memorycontainer/funclock/%s/%s" %
                (self.namespacemanager.namespace, self.key),
                reentrant=True)

        return self.funclock.acquire(wait)

    def unlock_createfunc(self):
        self.funclock.release()
示例#4
0
文件: container.py 项目: wdmchaft/hue
 def get_creation_lock(self, key):
     return NameLock(
         identifier="memorycontainer/funclock/%s/%s" % (self.namespace, key),
         reentrant=True
     )
示例#5
0
 def lock_createfunc(self, wait = True): 
     if self.funclock is None:
         self.funclock = NameLock(identifier = "memorycontainer/funclock/%s/%s" % (self.namespacemanager.namespace, self.key), reentrant = True)
         
     return self.funclock.acquire(wait)