Source:
public void run() { LOG.trace("BacklogCheckService running for entities"); try { AbstractWorkflowEngine wfEngine = getWorkflowEngine(); for (Entity entity : entityBacklogs.keySet()) { List<MetricInfo> metrics = entityBacklogs.get(entity); if (!metrics.isEmpty()) { synchronized (metrics) { Iterator iterator = metrics.iterator(); while (iterator.hasNext()) { MetricInfo metricInfo = (MetricInfo) iterator.next(); String nominalTimeStr = metricInfo.getNominalTime(); Date nominalTime; try { nominalTime = DATE_FORMAT.get().parse(nominalTimeStr); authenticateUser(entity); if (wfEngine.isMissing(entity)) { LOG.info("Entity of name was deleted so removing instance of " + "nominal time ", entity.getName(), nominalTimeStr); backlogMetricStore.deleteMetricInstance(entity.getName(), metricInfo.getCluster(), nominalTime, entity.getEntityType()); iterator.remove(); continue; } InstancesResult status = null; try { status = wfEngine.getStatus(entity, nominalTime, new Date(nominalTime.getTime() + 200), PROCESS_LIFE_CYCLE, false); } catch (FalconException e) { LOG.error("Unable to get status " + entity.getName() , e); continue; } if (status.getInstances().length > 0 && status.getInstances()[0].status == InstancesResult. WorkflowStatus.SUCCEEDED) { LOG.debug("Instance of nominal time of entity has succeeded, removing " + "from backlog entries", nominalTimeStr, entity.getName()); backlogMetricStore.deleteMetricInstance(entity.getName(), metricInfo.getCluster(), nominalTime, entity.getEntityType()); iterator.remove(); } } catch (ParseException e) { LOG.error("Unable to parse date " + nominalTimeStr); } } } } } } catch (Throwable e) { LOG.error("Error while checking backlog metrics" + e); } }

Target:
public void run() { LOG.trace("BacklogCheckService running for entities"); try { AbstractWorkflowEngine wfEngine = getWorkflowEngine(); for (Entity entity : entityBacklogs.keySet()) { List<MetricInfo> metrics = entityBacklogs.get(entity); if (!metrics.isEmpty()) { synchronized (metrics) { Iterator iterator = metrics.iterator(); while (iterator.hasNext()) { MetricInfo metricInfo = (MetricInfo) iterator.next(); String nominalTimeStr = metricInfo.getNominalTime(); Date nominalTime; try { nominalTime = DATE_FORMAT.get().parse(nominalTimeStr); authenticateUser(entity); if (wfEngine.isMissing(entity)) { LOG.info("Entity of name was deleted so removing instance of " + "nominal time ", entity.getName(), nominalTimeStr); backlogMetricStore.deleteMetricInstance(entity.getName(), metricInfo.getCluster(), nominalTime, entity.getEntityType()); iterator.remove(); continue; } InstancesResult status = null; try { status = wfEngine.getStatus(entity, nominalTime, new Date(nominalTime.getTime() + 200), PROCESS_LIFE_CYCLE, false); } catch (FalconException e) { LOG.error("Unable to get status for :" + entity.getName(), e); } if (status !=null && status.getInstances().length > 0 && status.getInstances()[0].status == InstancesResult. WorkflowStatus.SUCCEEDED) { LOG.debug("Instance of nominal time of entity has succeeded, removing " + "from backlog entries", nominalTimeStr, entity.getName()); backlogMetricStore.deleteMetricInstance(entity.getName(), metricInfo.getCluster(), nominalTime, entity.getEntityType()); iterator.remove(); } } catch (ParseException e) { LOG.error("Unable to parse date " + nominalTimeStr); } } } } } } catch (Throwable e) { LOG.error("Error while checking backlog metrics" + e); } }