final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1);
// Let core threads time out to avoid unnecessarily keeping a flapping state check thread alive
// for the majority of tasks that do not flap.
executor.setKeepAliveTime(5, SECONDS);
executor.allowCoreThreadTimeOut(true);
this.scheduler = MoreExecutors.getExitingScheduledExecutorService(executor, 0, SECONDS);
}
/**
* Get the current task throttle as derived from task runner events.