def run(self): try: while not self.isInterrupted() and self.processMsg(self.readInt()): pass except (Exception, ), ex: errmsg = ("Exception while processing message. ") logger().exception(errmsg) if self.parent().isConnected(): self.eWrapper().error(ex)
def run(self): """ generated source for method run """ try: # loop until thread is terminated while not self.isInterrupted() and self.processMsg(self.readInt()): pass except Exception as ex: errmsg = ("Exception while processing message. ") logger().exception(errmsg) if self.parent().isConnected(): self.eWrapper().error(ex) if self.parent().isConnected(): self.m_parent.close()
def __init__(self, listeners=None, messageTypes=None): """ Initializer. @param listeners=None mapping of existing listeners @param types=None method name to message type lookup """ self.listeners = listeners if listeners else {} self.messageTypes = messageTypes if messageTypes else message.registry self.logger = logger.logger()
def enableLogging(self, enable=True): """ Enable or disable logging of all messages. @param enable if True (default), enables logging; otherwise disables @return True if enabled, False otherwise """ if enable: self.logger = logger() self.registerAll(self.logMessage) else: self.unregisterAll(self.logMessage) return enable
def enableLogging(self, enable=True): """ Enable or disable logging of all messages. @param enable if True (default), enables logging; otherwise disables @return True if enabled, False otherwise """ if enable: self.logger = logger() self.receiver.registerAll(self.logMessage) else: self.receiver.unregisterAll(self.logMessage) return enable