[Zodb-checkins] CVS: StandaloneZODB/ZEO - ClientStorage.py:1.26.4.23

Jim Fulton jim@zope.com
Thu, 20 Dec 2001 15:44:56 -0500


Update of /cvs-repository/StandaloneZODB/ZEO
In directory cvs.zope.org:/tmp/cvs-serv27840/ZEO

Modified Files:
      Tag: ZEO-ZRPC-Dev
	ClientStorage.py 
Log Message:
When closing the storage, make sure we close the cache if we have one.
When checking the server, raise ClientDisconnected if we no longer have (or
never had) a connection.


=== StandaloneZODB/ZEO/ClientStorage.py 1.26.4.22 => 1.26.4.23 ===
 from ZODB.TimeStamp import TimeStamp
 from zeolog import LOG, PROBLEM, INFO, BLATHER
+from Exceptions import Disconnected
 
 def log2(type, msg, subsys="ClientStorage %d" % os.getpid()):
     LOG(subsys, type, msg)
@@ -126,7 +127,7 @@
 class UnrecognizedResult(ClientStorageError):
     """A server call returned an unrecognized result"""
 
-class ClientDisconnected(ClientStorageError):
+class ClientDisconnected(ClientStorageError, Disconnected):
     """The database storage is disconnected from the storage."""
 
 def get_timestamp(prev_ts):
@@ -324,6 +325,8 @@
         self._rpc_mgr.close()
         if self._server:
             self._server.rpc.close()
+        if self._cache is not None:
+            self._cache.close()
         
     def commitVersion(self, src, dest, transaction):
         self._check_trans(transaction,
@@ -349,6 +352,8 @@
         p = self._cache.load(oid, version)
         if p:
             return p
+        if self._server is None:
+            raise ClientDisconnected()
         p, s, v, pv, sv = self._server.zeoLoad(oid)
         self._cache.checkSize(0)
         self._cache.store(oid, p, s, v, pv, sv)