[Zodb-checkins] SVN: ZODB/trunk/src/ZEO/ClientStorage.py Simplified close logic -- now that we've gotten rid of the global

Jim Fulton jim at zope.com
Fri Feb 5 13:19:30 EST 2010


Log message for revision 108796:
  Simplified close logic -- now that we've gotten rid of the global
  client loop.  Now the _rpc_mgr close should take care of closing
  cleanly.
  

Changed:
  U   ZODB/trunk/src/ZEO/ClientStorage.py

-=-
Modified: ZODB/trunk/src/ZEO/ClientStorage.py
===================================================================
--- ZODB/trunk/src/ZEO/ClientStorage.py	2010-02-05 17:54:04 UTC (rev 108795)
+++ ZODB/trunk/src/ZEO/ClientStorage.py	2010-02-05 18:19:30 UTC (rev 108796)
@@ -445,25 +445,18 @@
             logger.info("%s Waiting for cache verification to finish",
                         self.__name__)
 
-    def close(self, kill=False):
+    def close(self):
         "Storage API: finalize the storage, releasing external resources."
-        if self._rpc_mgr is not None:
-            self._rpc_mgr.close()
-            self._rpc_mgr = None
+        _rpc_mgr = self._rpc_mgr
+        self._rpc_mgr = None
+        if _rpc_mgr is None:
+            return # already closed
 
-        if (self._connection is not None) and not kill:
-            event = threading.Event()
-            self._connection.trigger.pull_trigger(lambda: self._close(event))
-            event.wait(9)
-        else:
-            self._close()
-
-    def _close(self, event=None):
         if self._connection is not None:
             self._connection.register_object(None) # Don't call me!
-            self._connection.close()
-            self._connection = None
+        self._connection = None
 
+        _rpc_mgr.close()
         self._tbuf.close()
         if self._cache is not None:
             self._cache.close()
@@ -474,9 +467,6 @@
         if self._check_blob_size_thread is not None:
             self._check_blob_size_thread.join()
 
-        if event is not None:
-            event.set()
-
     _check_blob_size_thread = None
     def _check_blob_size(self, bytes=None):
         if self._blob_cache_size is None:



More information about the Zodb-checkins mailing list