@Override public void log(Logger log) { if (this.getExitReason() != null && this.getExitReason().getResult() == ProcessResult.SUCCESS) { return; } else if (this.getExitReason().isRethrow()) { if (this.getExitReason().isError()) { log.error("Exiting with code [{}] : {} : [{}]", this.getExitReason(), this.getCause().getClass() .getSimpleName(), this.getCause().getMessage()); } else { log.debug("Exiting with code [{}] : {} : [{}]", this.getExitReason(), this.getCause().getClass() .getSimpleName(), this.getCause().getMessage()); } } else if (this.getExitReason().isError()) { log.error("Exiting with code [{}] : {}", this.getExitReason(), this.getMessage(), this.getCause()); } else { log.debug("Exiting with code [{}] : {}", this.getExitReason(), this.getMessage(), this.getCause() != null ? this.getCause().getMessage() : StringUtils.EMPTY); } }
protected void scheduleProcess(Runnable run) { try { run.run(); } catch (ProcessInstanceException e) { if (e.getExitReason() == ExitReason.RESOURCE_BUSY || e.getExitReason() == ExitReason.CANCELED) { throw new ClientVisibleException(ResponseCodes.CONFLICT); } else { throw e; } } }
log.debug("Failed to find process for id [{}]", processId); } catch (ProcessInstanceException e) { counters.get(e.getExitReason()).inc(); if (e.getExitReason().isError()) { log.error("Process [{}:{}] on [{}] failed, exit [{}] : {}", instance.getName(), processId, instance.getResourceId(), e .getExitReason(), e.getMessage());
if (e.isLock(lockDef)) { exit(PROCESS_ALREADY_IN_PROGRESS); throw new ProcessInstanceException(this, new ProcessExecutionExitException(PROCESS_ALREADY_IN_PROGRESS)); } else { throw e;
@Override public void scheduleProcessInstance(LaunchConfiguration config) { ProcessInstance pi = createProcessInstance(new ProcessRecord(config, null, null), true, false); try { pi.execute(); } catch (ProcessInstanceException e) { if (e.getExitReason() == SCHEDULED) { return; } else { throw e; } } }
protected ExitReason executeWithProcessInstanceLock() { EngineContext engineContext = EngineContext.getEngineContext(); try { runDelegateLoop(engineContext); return exit(ExitReason.DONE); } catch (ProcessExecutionExitException e) { exit(e.getExitReason()); if (e.getExitReason() != null && e.getExitReason().getResult() == ProcessResult.SUCCESS) { return e.getExitReason(); } if (e.getExitReason().isRethrow()) { Throwable t = e.getCause(); ExceptionUtils.rethrowRuntime(t == null ? e : t); } throw new ProcessInstanceException(this, e); } finally { context.getProcessManager().persistState(this, schedule); } }
protected void pingFailure(Agent agent) { long count = status.getUnchecked(agent.getId()).failed(); if (count < 3) { log.info("Missed ping from agent [{}] count [{}]", agent.getId(), count); } else { log.error("Failed to get ping from agent [{}] count [{}]", agent.getId(), count); } if (count >= BAD_PINGS.get()) { try { agent = objectManager.reload(agent); if (CommonStatesConstants.ACTIVE.equals(agent.getState())) { Host host = objectManager.findAny(Host.class, HOST.AGENT_ID, agent.getId()); if (host != null) { log.error("Scheduling reconnect for agent [{}] host [{}] count [{}]", agent.getId(), host.getId(), count); } else { log.error("Scheduling reconnect for agent [{}] count [{}]", agent.getId(), count); } processManager.scheduleProcessInstance(AgentConstants.PROCESS_RECONNECT, agent, null); } } catch (ProcessInstanceException e) { if (e.getExitReason() != ExitReason.CANCELED) { throw e; } } } }