use of com.hazelcast.jet.core.JobStatus in project hazelcast-jet by hazelcast.
the class MasterContext method setJobStatusToStarting.
/**
* Sets job status to starting.
* Returns false if the job start process cannot proceed.
*/
private boolean setJobStatusToStarting() {
JobStatus status = jobStatus();
if (status == COMPLETED || status == FAILED) {
logger.severe("Cannot init job " + idToString(jobId) + ": it is already " + status);
return false;
}
if (cancellationToken.isCompleted()) {
logger.fine("Skipping init job " + idToString(jobId) + ": is already cancelled.");
finalizeJob(new CancellationException());
return false;
}
if (status == NOT_STARTED) {
if (!jobStatus.compareAndSet(NOT_STARTED, STARTING)) {
logger.fine("Cannot init job " + idToString(jobId) + ": someone else is just starting it");
return false;
}
jobStartTime = System.currentTimeMillis();
}
status = jobStatus();
if (!(status == STARTING || status == RESTARTING)) {
logger.severe("Cannot init job " + idToString(jobId) + ": status is " + status);
return false;
}
return true;
}
Aggregations