def __init__(self): super(BeamTimeBasedOutputStream).__init__() self._flush_event = False self._periodic_flusher = PeriodicThread(1, self.notify_flush) self._periodic_flusher.daemon = True self._periodic_flusher.start() self._output_stream = None
def _schedule_periodic_shutdown(self): def shutdown_inactive_bundle_processors(): for descriptor_id, last_access_time in self.last_access_times.items(): if (time.time() - last_access_time > DEFAULT_BUNDLE_PROCESSOR_CACHE_SHUTDOWN_THRESHOLD_S): BundleProcessorCache._shutdown_cached_bundle_processors( self.cached_bundle_processors[descriptor_id]) self.periodic_shutdown = PeriodicThread( DEFAULT_BUNDLE_PROCESSOR_CACHE_SHUTDOWN_THRESHOLD_S, shutdown_inactive_bundle_processors) self.periodic_shutdown.daemon = True self.periodic_shutdown.start()