Search in sources :

Example 1 with ScheduleAddedEvent

use of com.netflix.titus.common.framework.scheduler.model.event.ScheduleAddedEvent in project titus-control-plane by Netflix.

the class DefaultLocalScheduler method doRun.

private void doRun() {
    Stopwatch timer = Stopwatch.createStarted();
    List<ScheduleHolder> holders = new ArrayList<>();
    newHolders.drainTo(holders);
    holders.forEach(h -> {
        activeHoldersById.put(h.getSchedule().getId(), h);
        eventProcessor.onNext(new ScheduleAddedEvent(h.getSchedule()));
    });
    try {
        activeHoldersById.values().forEach(ScheduleHolder::handleExecution);
    } catch (Exception e) {
        logger.warn("Unexpected error in the internal scheduler loop", e);
    } finally {
        scheduleNextIteration();
        metrics.recordEvaluationTime(timer.elapsed(TimeUnit.MILLISECONDS));
    }
}
Also used : ScheduleAddedEvent(com.netflix.titus.common.framework.scheduler.model.event.ScheduleAddedEvent) Stopwatch(com.google.common.base.Stopwatch) ArrayList(java.util.ArrayList) LocalSchedulerException(com.netflix.titus.common.framework.scheduler.LocalSchedulerException)

Aggregations

Stopwatch (com.google.common.base.Stopwatch)1 LocalSchedulerException (com.netflix.titus.common.framework.scheduler.LocalSchedulerException)1 ScheduleAddedEvent (com.netflix.titus.common.framework.scheduler.model.event.ScheduleAddedEvent)1 ArrayList (java.util.ArrayList)1