Ejemplo n.º 1
0
class ThreadFlushEngine(FlushEngine):
  """Class that uses a thread to periodically flush.
  """
  def __init__(self, period, flush_fn):
    super(ThreadFlushEngine, self).__init__(period, flush_fn)
    self._thread = PeriodicTask(self._period, self._flush_fn)

  def start(self):
    """Override of base method.
    """
    self._thread.start()

  def stop(self):
    """Override of base method.
    """
    self._thread.stop()