[Erp5-report] r14053 - /erp5/trunk/utils/oood/pool.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Apr 11 18:44:40 CEST 2007


Author: bartek
Date: Wed Apr 11 18:44:38 2007
New Revision: 14053

URL: http://svn.erp5.org?rev=14053&view=rev
Log:
placeholders for new implementation

Modified:
    erp5/trunk/utils/oood/pool.py

Modified: erp5/trunk/utils/oood/pool.py
URL: http://svn.erp5.org/erp5/trunk/utils/oood/pool.py?rev=14053&r1=14052&r2=14053&view=diff
==============================================================================
--- erp5/trunk/utils/oood/pool.py (original)
+++ erp5/trunk/utils/oood/pool.py Wed Apr 11 18:44:38 2007
@@ -54,7 +54,7 @@
     """
       set up semaphore, make workers
     """
-    self.sem = threading.Semaphore(self.total)
+    self.sem = threading.Semaphore(self.total) # this will go out some day
     for i in range(self.total):
       self._mkWorker(i)
 
@@ -71,6 +71,44 @@
     except KeyError: # after restart this timer is not there
       pass
     self.sem.release()
+
+  def getWorkerObject(self, worker=None):
+    """
+      New way of getting worker object
+      if worker is None, only check if one is available
+      otherwise return false, all the rest is done by dispatcher
+      if worker is given as an argument, this method kills it
+      (possibly tests it first, maybe it is good?) - but if it is frozen, 
+      the only way to test is time out...
+      and produces and returns a new one
+      XXX it should produce a new one first, and then replace the old one
+      or kill if new one could not be made
+      so that getSize always returns the right value
+    """
+    pass
+
+  def releaseWorker(self, worker):
+    """
+      Release worker so that it is available
+      Return True if successful
+      XXX what to do if not successful? I'd kill it to reduce pool size.
+    """
+    pass
+
+  def getSize(self):
+    """
+      return number of existing workers (busy or not)
+      so that we can check if the pool is usable at all
+    """
+    pass
+
+  def initializePool(self):
+    """
+      kill all workers if any are present
+      build new ones
+      (same as in __init__ - can we call __init__ from here?)
+    """
+    pass
 
   def getWorker(self):
     """




More information about the Erp5-report mailing list