[Zodb-checkins] CVS: ZODB3/bsddb3Storage/bsddb3Storage - Minimal.py:1.18

Barry Warsaw barry@wooz.org
Fri, 22 Nov 2002 17:24:11 -0500


Update of /cvs-repository/ZODB3/bsddb3Storage/bsddb3Storage
In directory cvs.zope.org:/tmp/cvs-serv20149

Modified Files:
	Minimal.py 
Log Message:
Refactoring.

close(): The base class can now do all the work of closing, including
stopping the background threads.

log(): Much more convenient.


=== ZODB3/bsddb3Storage/bsddb3Storage/Minimal.py 1.17 => 1.18 ===
--- ZODB3/bsddb3Storage/bsddb3Storage/Minimal.py:1.17	Tue Nov 19 15:39:51 2002
+++ ZODB3/bsddb3Storage/bsddb3Storage/Minimal.py	Fri Nov 22 17:24:11 2002
@@ -29,7 +29,6 @@
 from ZODB.utils import U64, p64
 from ZODB.referencesf import referencesf
 from ZODB.ConflictResolution import ConflictResolvingStorage, ResolvedSerial
-import zLOG
 
 # BerkeleyBase class provides some common functionality for BerkeleyDB-based
 # storages.  It in turn inherits from BaseStorage which itself provides some
@@ -138,25 +137,6 @@
             self._autopacker = _Autopack(self, config.frequency)
             self._autopacker.start()
 
-    def close(self):
-        # Set this flag before acquiring the lock so we don't block waiting
-        # for the autopack thread to give up the lock.
-        self._stop = True
-        self._lock_acquire()
-        try:
-            # We must stop the autopacker and checkpointing threads first
-            # before closing any tables.  I'm not sure about the join()
-            # timeout, but I'd be surprised if any particular iteration of a
-            # pack-related loops take longer than a few seconds.
-            if self._autopacker:
-                zLOG.LOG('Minimal storage', zLOG.INFO,
-                         'stopping autopack thread')
-                self._autopacker.stop()
-                self._autopacker.join(30)
-            BerkeleyBase.close(self)
-        finally:
-            self._lock_release()
-
     def _doabort(self, txn, tid):
         co = cs = None
         try:
@@ -377,7 +357,7 @@
         # to pass that around to the helper methods, so just assert they're
         # the same.
         assert zreferencesf == referencesf
-        zLOG.LOG('Minimal storage', zLOG.INFO, 'classic pack started')
+        self.log('classic pack started')
         # A simple wrapper around the bulk of packing, but which acquires a
         # lock that prevents multiple packs from running at the same time.
         self._packlock.acquire()
@@ -392,7 +372,7 @@
             self._dopack()
         finally:
             self._packlock.release()
-        zLOG.LOG('Minimal storage', zLOG.INFO, 'classic pack finished')
+        self.log('classic pack finished')
 
     def _dopack(self):
         # Do a mark and sweep for garbage collection.  Calculate the set of