from neo.lib.dispatcher import Dispatcher, ForgottenPacket from neo.lib.threaded_app import ThreadedApplication from .cache import ClientCache from .pool import ConnectionPool from neo.lib.util import p64, u64, parseMasterList from neo.lib.debug import register as registerLiveDebugger CHECKED_SERIAL = object() try: from Signals.Signals import SignalHandler except ImportError: SignalHandler = None if SignalHandler: import signal SignalHandler.registerHandler(signal.SIGUSR2, logging.reopen) class TransactionContainer(dict): def pop(self, txn): return dict.pop(self, id(txn), None) def get(self, txn): try: return self[id(txn)] except KeyError: raise StorageTransactionError("unknown transaction %r" % txn) def new(self, txn): key = id(txn) if key in self:
from Signals.Signals import SignalHandler import logging log = logging.getLogger("BackgroundThread") class DummyThread(object): """ """ running = True def __init__(self): pass # set up any static resources it needs def __call__(self, cfg_args): interval = float(cfg_args['ping-interval-secs']) ping_url = cfg_args['keepalive-host'] while self.running: log.info("(pinging host %r)" % ping_url) time.sleep(interval) log.info("_shutdown_phase told me to stop") def stopme(self): log.info("exiting process, stopping thread") print "exiting process, stopping thread" self.running = False dummythreadfunc = DummyThread() SignalHandler.registerHandler(SIGINT, dummythreadfunc.stopme)
from neo.lib.dispatcher import Dispatcher, ForgottenPacket from neo.lib.threaded_app import ThreadedApplication from .cache import ClientCache from .pool import ConnectionPool from neo.lib.util import p64, u64, parseMasterList from neo.lib.debug import register as registerLiveDebugger CHECKED_SERIAL = object() try: from Signals.Signals import SignalHandler except ImportError: SignalHandler = None if SignalHandler: import signal SignalHandler.registerHandler(signal.SIGUSR2, logging.reopen) class TransactionContainer(dict): def pop(self, txn): return dict.pop(self, id(txn), None) def get(self, txn): try: return self[id(txn)] except KeyError: raise StorageTransactionError("unknown transaction %r" % txn) def new(self, txn): key = id(txn)