'Event loop.'

def Run(self):

    try:
        while 1:
            if master.MASTER_WATCHER.IsMaster():
                processed = self.RunOnce()
            else:
                processed = 0
            if (processed == 0):
                logger = logging.getLogger()
                for h in logger.handlers:
                    h.flush()
                if ((time.time() - self.last_active) > self.SHORT_POLL_TIME):
                    interval = self.POLLING_INTERVAL
                else:
                    interval = self.SHORT_POLLING_INTERVAL
                time.sleep(interval)
            else:
                self.last_active = time.time()
    except KeyboardInterrupt:
        logging.info('Caught    interrupt,    exiting.')
        self.__class__.thread_pool.Join()
