Source:
private boolean checkEntityInstanceAvailability(String entityName, String clusterName, Date nominalTime, String entityType) throws FalconException { Entity entity = EntityUtil.getEntity(entityType, entityName); if (entity.getACL().getOwner() != null && !entity.getACL().getOwner().isEmpty()) { CurrentUser.authenticate(entity.getACL().getOwner()); } else { CurrentUser.authenticate(System.getProperty("user.name")); } try { if (entityType.equals(EntityType.PROCESS.toString())){ LOG.debug("Checking instance availability status for entity:{}, cluster:{}, " + "instanceTime:{}", entity.getName(), clusterName, nominalTime, entityType); AbstractWorkflowEngine wfEngine = WorkflowEngineFactory.getWorkflowEngine(); InstancesResult instancesResult = wfEngine.getStatus(entity, nominalTime, nominalTime, null, null); if (instancesResult.getStatus().equals(APIResult.Status.SUCCEEDED)){ LOG.debug("Entity instance(feed:{}, cluster:{}, instanceTime:{}) is available.", entity.getName(), clusterName, nominalTime); return true; } return false; } if (entityType.equals(EntityType.FEED.toString())){ LOG.debug("Checking instance availability status for feed:{}, cluster:{}, instanceTime:{}", entity.getName(), clusterName, nominalTime); FeedInstanceStatus.AvailabilityStatus status = FeedHelper.getFeedInstanceStatus((Feed) entity, clusterName, nominalTime); if (status.equals(FeedInstanceStatus.AvailabilityStatus.AVAILABLE) || status.equals(FeedInstanceStatus.AvailabilityStatus.EMPTY)) { LOG.debug("Feed instance(feed:{}, cluster:{}, instanceTime:{}) is available.", entity.getName(), clusterName, nominalTime); return true; } } } catch (Throwable e) { LOG.error("Couldn't find status for Entity:{}, cluster:{}, entityType{}, nominalTime{}", entityName, clusterName, entityType, nominalTime, e); } LOG.debug("Entity instance(entity:{}, cluster:{}, instanceTime:{}) is not available.", entity.getName(), clusterName, nominalTime); return false; }

Target:
private boolean checkEntityInstanceAvailability(String entityName, String clusterName, Date nominalTime, String entityType) throws FalconException { Entity entity = EntityUtil.getEntity(entityType, entityName); authenticateUser(entity); try { if (entityType.equals(EntityType.PROCESS.toString())){ LOG.debug("Checking instance availability status for entity:{}, cluster:{}, " + "instanceTime:{}", entity.getName(), clusterName, nominalTime, entityType); AbstractWorkflowEngine wfEngine = WorkflowEngineFactory.getWorkflowEngine(); InstancesResult instancesResult = wfEngine.getStatus(entity, nominalTime, nominalTime, null, null); if (instancesResult.getStatus().equals(APIResult.Status.SUCCEEDED)){ LOG.debug("Entity instance(feed:{}, cluster:{}, instanceTime:{}) is available.", entity.getName(), clusterName, nominalTime); return true; } return false; } if (entityType.equals(EntityType.FEED.toString())){ LOG.debug("Checking instance availability status for feed:{}, cluster:{}, instanceTime:{}", entity.getName(), clusterName, nominalTime); FeedInstanceStatus.AvailabilityStatus status = FeedHelper.getFeedInstanceStatus((Feed) entity, clusterName, nominalTime); if (status.equals(FeedInstanceStatus.AvailabilityStatus.AVAILABLE) || status.equals(FeedInstanceStatus.AvailabilityStatus.EMPTY)) { LOG.debug("Feed instance(feed:{}, cluster:{}, instanceTime:{}) is available.", entity.getName(), clusterName, nominalTime); return true; } } } catch (Throwable e) { LOG.error("Couldn't find status for Entity:{}, cluster:{}, entityType{}, nominalTime{}", entityName, clusterName, entityType, nominalTime, e); } LOG.debug("Entity instance(entity:{}, cluster:{}, instanceTime:{}) is not available.", entity.getName(), clusterName, nominalTime); return false; }