} catch (Throwable t) {
throw new CommandException(t.getMessage());
}
Calendar now = Calendar.getInstance();
CommandResult cr = null;
String failureReason = null;
for (int i=1; i<4 && cr == null; i++) {
failureReason = null;
try {
cr = submit(job);
} catch (CommandException ce) {
failureReason = ce.getMessage();
logger.warn("submission to BLAH failed [jobId=" + job.getId() + "; reason=" + failureReason + "; retry count=" + i + "/3]");
synchronized(now) {
try {
logger.debug("sleeping 10 sec...");
now.wait(10000);
logger.debug("sleeping 10 sec... done");
} catch (InterruptedException e) {
logger.warn(e.getMessage());
}
}
}
}
if (cr == null) {
status = new JobStatus(JobStatus.ABORTED, job.getId());
status.setDescription("submission to BLAH failed [retry count=3]");
status.setFailureReason(failureReason);
try {
doOnJobStatusChanged(status, job);
} catch (Throwable te) {
throw new CommandException(te.getMessage());
}
setLeaseExpired(job);
throw new CommandException("submission to BLAH failed [retry count=3]" + (failureReason != null ? ": " + failureReason : ""));
}
job.setLRMSJobId(cr.getParameterAsString("LRMS_JOB_ID"));
job.setLRMSAbsLayerJobId(cr.getParameterAsString("LRMS_ABS_JOB_ID"));
try {
if (isEmptyField(job.getLRMSAbsLayerJobId())) {
status = new JobStatus(JobStatus.ABORTED, job.getId());
status.setFailureReason("LRMSAbsLayerJobId not found!");