[Erp5-report] r22451 - /erp5/trunk/products/CMFActivity/ActivityTool.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jul 11 14:46:31 CEST 2008


Author: vincent
Date: Fri Jul 11 14:46:30 2008
New Revision: 22451

URL: http://svn.erp5.org?rev=22451&view=rev
Log:
Do not store "_is_running" or "_has_processed_shutdown" on a persistent object. Use global variables instead.

Modified:
    erp5/trunk/products/CMFActivity/ActivityTool.py

Modified: erp5/trunk/products/CMFActivity/ActivityTool.py
URL: http://svn.erp5.org/erp5/trunk/products/CMFActivity/ActivityTool.py?rev=22451&r1=22450&r2=22451&view=diff
==============================================================================
--- erp5/trunk/products/CMFActivity/ActivityTool.py (original)
+++ erp5/trunk/products/CMFActivity/ActivityTool.py Fri Jul 11 14:46:30 2008
@@ -333,6 +333,13 @@
                   self.__dict__['__active_process'],
                   self.__dict__['__kw'], id)
 
+# Set to False when shutting down. Access outside of process_shutdown must
+# be done under the protection of is_running_lock lock.
+is_running = True
+# True when activities cannot be executing any more.
+has_processed_shutdown = False
+
+
 class ActivityTool (Folder, UniqueObject):
     """
     ActivityTool is the central point for activity management.
@@ -376,11 +383,6 @@
     
     distributingNode = ''
     _nodes = ()
-    # Set to False when shutting down. Access outside of process_shutdown must
-    # be done under the protection of is_running_lock lock.
-    _is_running = True
-    # True when activities cannot be executing any more.
-    _has_processed_shutdown = False
 
     def __init__(self):
         return Folder.__init__(self, ActivityTool.id)
@@ -603,9 +605,9 @@
           Prevent shutdown from happening while an activity queue is
           processing a batch.
         """
-        self._is_running = False
-        if phase == 3 and not self._has_processed_shutdown:
-          self._has_processed_shutdown = True
+        is_running = False
+        if phase == 3 and not has_processed_shutdown:
+          has_processed_shutdown = True
           LOG('CMFActivity', INFO, "Shutdown: Waiting for activities to finish.")
           is_running_lock.acquire()
           LOG('CMFActivity', INFO, "Shutdown: Activities finished.")
@@ -727,7 +729,7 @@
           for activity in activity_list:
             is_running_lock.acquire()
             try:
-              if self._is_running:
+              if is_running:
                 activity.tic(inner_self, processing_node) # Transaction processing is the responsability of the activity
                 has_awake_activity = has_awake_activity or activity.isAwake(inner_self, processing_node)
             finally:




More information about the Erp5-report mailing list