/** * Checks the current active status of the job to which the task belongs. If this check can be made successfully then the status * check time of the supplied task message is updated. * * @param tm the task message whose job status will be verified * @return true if the task's job is active or the job status could not be checked, false if the status could be checked and the * job is found to be inactive (aborted, cancelled, etc.) */ private boolean performJobStatusCheck(TaskMessage tm) throws InvalidJobTaskIdException { Objects.requireNonNull(tm); TrackingInfo tracking = tm.getTracking(); Objects.requireNonNull(tracking); String statusCheckUrl = tracking.getStatusCheckUrl(); if (statusCheckUrl == null) { //If statusCheckUrl is null then we can't perform the status check so we have to assume the job is active. return true; } String jobId = tracking.getJobId(); LOG.debug("Task {} (job {}) - attempting to check job status", tm.getTaskId(), jobId); JobStatusResponse jobStatus = getJobStatus(jobId, statusCheckUrl); long newStatusCheckTime = System.currentTimeMillis() + jobStatus.getStatusCheckIntervalMillis(); LOG.debug("Task {} (job {}) - updating status check time from {} to {}", tm.getTaskId(), jobId, tracking.getStatusCheckTime(), new Date(newStatusCheckTime)); tracking.setStatusCheckTime(new Date(newStatusCheckTime)); return jobStatus.isActive(); }