Author: justi9
Date: 2008-12-04 17:39:37 -0500 (Thu, 04 Dec 2008)
New Revision: 2929
Modified:
mgmt/trunk/mint/python/mint/dbexpire.py
mgmt/trunk/mint/python/mint/update.py
Log:
Convert mint threads to use the DaemonThread in util; this fixes the C-c issues
Modified: mgmt/trunk/mint/python/mint/dbexpire.py
===================================================================
--- mgmt/trunk/mint/python/mint/dbexpire.py 2008-12-04 20:26:02 UTC (rev 2928)
+++ mgmt/trunk/mint/python/mint/dbexpire.py 2008-12-04 22:39:37 UTC (rev 2929)
@@ -4,16 +4,14 @@
from threading import Thread
from mint.schema import *
from sql import *
+from util import *
log = logging.getLogger("mint.dbexpire")
-class DBExpireThread(Thread):
+class DBExpireThread(MintDaemonThread):
def __init__(self, model, frequency, threshold, keepCurrStats=False):
- super(DBExpireThread, self).__init__()
+ super(DBExpireThread, self).__init__(model)
- self.model = model
- self.setDaemon(False)
- self.stopRequested = False
self.frequency = frequency
self.threshold = threshold
self.keepCurrStats = keepCurrStats
Modified: mgmt/trunk/mint/python/mint/update.py
===================================================================
--- mgmt/trunk/mint/python/mint/update.py 2008-12-04 20:26:02 UTC (rev 2928)
+++ mgmt/trunk/mint/python/mint/update.py 2008-12-04 22:39:37 UTC (rev 2929)
@@ -13,23 +13,20 @@
from time import clock
from sql import *
from collections import deque
+from util import *
log = logging.getLogger("mint.update")
-class ModelUpdateThread(Thread):
+class ModelUpdateThread(MintDaemonThread):
def __init__(self, model):
- super(ModelUpdateThread, self).__init__()
+ super(ModelUpdateThread, self).__init__(model)
- self.model = model
self.updates = UpdateQueue(slotCount=2)
- self.stopRequested = False
self.enqueueCount = 0
self.dequeueCount = 0
self.commitThreshold = 100
- self.setDaemon(False)
-
def enqueue(self, update):
try:
self.updates.put(update)
@@ -85,10 +82,7 @@
broker.objectDatabaseIds.rollback()
log.exception("Update failed")
-
- def stop(self):
- self.stopRequested = True
-
+
class ReferenceException(Exception):
def __init__(self, sought):
self.sought = sought
Show replies by date