public virtual ProcessEngineException wrapJobExecutionFailure(JobFailureCollector jobFailureCollector, Exception cause) { JobEntity job = jobFailureCollector.Job; if (job != null) { return(new ProcessEngineException(exceptionMessage("025", "Exception while executing job {}: ", jobFailureCollector.Job), cause)); } else { return(new ProcessEngineException(exceptionMessage("025", "Exception while executing job {}: ", jobFailureCollector.JobId), cause)); } }
protected internal static void invokeJobListener(CommandExecutor commandExecutor, JobFailureCollector jobFailureCollector) { if (!string.ReferenceEquals(jobFailureCollector.JobId, null)) { if (jobFailureCollector.Failure != null) { // the failed job listener is responsible for decrementing the retries and logging the exception to the DB. FailedJobListener failedJobListener = createFailedJobListener(commandExecutor, jobFailureCollector.Failure, jobFailureCollector.JobId); OptimisticLockingException exception = callFailedJobListenerWithRetries(commandExecutor, failedJobListener); if (exception != null) { throw exception; } } else { SuccessfulJobListener successListener = createSuccessfulJobListener(commandExecutor); commandExecutor.execute(successListener); } } }
public static void executeJob(string nextJobId, CommandExecutor commandExecutor, JobFailureCollector jobFailureCollector, Command <Void> cmd) { try { commandExecutor.execute(cmd); } catch (Exception exception) { handleJobFailure(nextJobId, jobFailureCollector, exception); // throw the original exception to indicate the ExecuteJobCmd failed throw exception; } catch (Exception exception) { handleJobFailure(nextJobId, jobFailureCollector, exception); // wrap the exception and throw it to indicate the ExecuteJobCmd failed throw LOG.wrapJobExecutionFailure(jobFailureCollector, exception); } finally { invokeJobListener(commandExecutor, jobFailureCollector); } }
public static void executeJob(string jobId, CommandExecutor commandExecutor) { JobFailureCollector jobFailureCollector = new JobFailureCollector(jobId); executeJob(jobId, commandExecutor, jobFailureCollector, new ExecuteJobsCmd(jobId, jobFailureCollector)); }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: protected static void handleJobFailure(final String nextJobId, final JobFailureCollector jobFailureCollector, Throwable exception) protected internal static void handleJobFailure(string nextJobId, JobFailureCollector jobFailureCollector, Exception exception) { LOGGING_HANDLER.exceptionWhileExecutingJob(nextJobId, exception); jobFailureCollector.Failure = exception; }