use of com.netflix.titus.api.containerhealth.model.event.ContainerHealthUpdateEvent in project titus-control-plane by Netflix.
the class EurekaContainerHealthService method handleTaskStateUpdate.
private Optional<ContainerHealthEvent> handleTaskStateUpdate(Job<?> job, Task task, ConcurrentMap<String, ContainerHealthEvent> state) {
ContainerHealthUpdateEvent lastEvent = (ContainerHealthUpdateEvent) state.get(task.getId());
if (lastEvent == null) {
return Optional.of(recordNewState(state, task, ContainerHealthEvent.healthChanged(buildHealthStatus(job, task))));
}
ContainerHealthState newTaskState = takeStateOf(job, task);
String newReason = takeStateReasonOf(job, task);
if (lastEvent.getContainerHealthStatus().getState() == newTaskState && lastEvent.getContainerHealthStatus().getReason().equals(newReason)) {
return Optional.empty();
}
return Optional.of(recordNewState(state, task, ContainerHealthEvent.healthChanged(buildHealthStatus(task, newTaskState, newReason))));
}
Aggregations