@Override
protected CoordinatorActionInfo call(CoordinatorStore store) throws StoreException, CommandException {
try {
CoordinatorJobBean coordJob = store.getCoordinatorJob(jobId, false);
CoordinatorActionInfo coordInfo = null;
setLogInfo(coordJob);
if (coordJob.getStatus() != CoordinatorJob.Status.KILLED
&& coordJob.getStatus() != CoordinatorJob.Status.FAILED) {
incrJobCounter(1);
List<CoordinatorActionBean> coordActions;
if (rerunType.equals(RestConstants.JOB_COORD_RERUN_DATE)) {
coordActions = getCoordActionsFromDates(jobId, scope, store);
}
else if (rerunType.equals(RestConstants.JOB_COORD_RERUN_ACTION)) {
coordActions = getCoordActionsFromIds(jobId, scope, store);
}
else {
throw new CommandException(ErrorCode.E1018, "date or action expected.");
}
if (checkAllActionsRunnable(coordActions)) {
Configuration conf = new XConfiguration(new StringReader(coordJob.getConf()));
for (CoordinatorActionBean coordAction : coordActions) {
String actionXml = coordAction.getActionXml();
if (!noCleanup) {
Element eAction = XmlUtils.parseXml(actionXml);
cleanupOutputEvents(eAction, coordJob.getUser(), coordJob.getGroup(), conf);
}
if (refresh) {
refreshAction(coordJob, coordAction, store);
}
updateAction(coordJob, coordAction, actionXml, store);
// TODO: time 100s should be configurable
queueCallable(new CoordActionNotification(coordAction), 100);
queueCallable(new CoordActionInputCheckCommand(coordAction.getId()), 100);
}
}
else {
throw new CommandException(ErrorCode.E1018, "part or all actions are not eligible to rerun!");
}
coordInfo = new CoordinatorActionInfo(coordActions);
}
else {
log.info("CoordRerunCommand is not able to run, job status=" + coordJob.getStatus() + ", jobid="
+ jobId);
throw new CommandException(ErrorCode.E1018,