code: public void updateJobStatus(final InternalJobStatus newJobStatus, String optionalMessage) {
  
  		// Check if the new job status equals the old one
  		if (this.jobStatus.getAndSet(newJobStatus) == newJobStatus) {
  			return;
  		}
  
  		// The task caused the entire job to fail, save the error description
  		if (newJobStatus == InternalJobStatus.FAILING) {
  			this.errorDescription = optionalMessage;
  		}
  
  		// If this is the final failure state change, reuse the saved error description
  		if (newJobStatus == InternalJobStatus.FAILED) {
  			optionalMessage = this.errorDescription;
  		}
  
  		final Iterator<JobStatusListener> it = this.jobStatusListeners.iterator();
  		while (it.hasNext()) {
  			it.next().jobStatusHasChanged(this, newJobStatus, optionalMessage);
  		}
  	}
docs: Updates the job status to given status and triggers the execution of the {@link JobStatusListener} objects.
  
  @param newJobStatus
  the new job status
  @param optionalMessage
  an optional message providing details on the reasons for the state change