Source:
private Boolean isSlaMissed(final ExecutableFlow flow) { final SlaType type = slaOption.getType(); logger.info("SLA type for flow " + flow.toString() + " is " + type); if (flow.getStartTime() < 0) { logger.info("Start time is less than 0 for flow " + flow.toString()); return false; } Status status; if (type.getComponent() == SlaType.ComponentType.FLOW) { logger.info("SLA type is flow."); if (this.checkTime < flow.getStartTime()) { logger.info("checktime = " + this.checkTime); logger.info("SLA duration = " + slaOption.getDuration().toMillis()); this.checkTime = flow.getStartTime() + slaOption.getDuration().toMillis(); logger.info("checktime updated to " + this.checkTime); } status = flow.getStatus(); logger.info("Flow status = " + status); } else { final ExecutableNode node = flow.getExecutableNode(slaOption.getJobName()); if (node.getStartTime() < 0) { return false; } if (this.checkTime < node.getStartTime()) { this.checkTime = node.getStartTime() + slaOption.getDuration().toMillis(); } status = node.getStatus(); } if (this.checkTime < DateTime.now().getMillis()) { switch (slaOption.getType()) { case FLOW_FINISH: logger.info("isFlowFinished?"); return !isFlowFinished(status); case FLOW_SUCCEED: logger.info("isFlowSucceeded?"); return !isFlowSucceeded(status); case JOB_FINISH: return !isJobFinished(status); case JOB_SUCCEED: return !isJobFinished(status); } } else if (slaOption.getType().getStatus() == StatusType.SUCCEED) { logger.info("slaOption.status = SUCCEED and status = " + status); return (status == Status.FAILED || status == Status.KILLED); } return false; }

Target:
private Boolean isSlaMissed(final ExecutableFlow flow) { final SlaType type = slaOption.getType(); logger.info("SLA type for flow " + flow.getId() + " is " + type); if (flow.getStartTime() < 0) { logger.info("Start time is less than 0 for flow " + flow.getId()); return false; } Status status; if (type.getComponent() == SlaType.ComponentType.FLOW) { logger.info("SLA type is flow."); if (this.checkTime < flow.getStartTime()) { logger.info("checktime = " + this.checkTime); logger.info("SLA duration = " + slaOption.getDuration().toMillis() + " ms"); this.checkTime = flow.getStartTime() + slaOption.getDuration().toMillis(); logger.info("checktime updated to " + this.checkTime); } status = flow.getStatus(); logger.info("Flow status = " + status.toString()); } else { final ExecutableNode node = flow.getExecutableNode(slaOption.getJobName()); if (node.getStartTime() < 0) { return false; } if (this.checkTime < node.getStartTime()) { this.checkTime = node.getStartTime() + slaOption.getDuration().toMillis(); } status = node.getStatus(); } if (this.checkTime < DateTime.now().getMillis()) { switch (slaOption.getType()) { case FLOW_FINISH: logger.info("isFlowFinished?"); return !isFlowFinished(status); case FLOW_SUCCEED: logger.info("isFlowSucceeded?"); return !isFlowSucceeded(status); case JOB_FINISH: return !isJobFinished(status); case JOB_SUCCEED: return !isJobFinished(status); } } else if (slaOption.getType().getStatus() == StatusType.SUCCEED) { logger.info("slaOption.status = SUCCEED and status = " + status.toString()); return (status == Status.FAILED || status == Status.KILLED); } return false; }