protected void suspendAcquisition(long millis) { if (millis <= 0) { return; } try { LOG.debugJobAcquisitionThreadSleeping(millis); synchronized (MONITOR) { if(!isInterrupted) { isWaiting.set(true); MONITOR.wait(millis); } } LOG.jobExecutorThreadWokeUp(); } catch (InterruptedException e) { LOG.jobExecutionWaitInterrupted(); } finally { isWaiting.set(false); } }
@Override protected void logNotDeterminingPriority(ExecutionEntity execution, Object value, ProcessEngineException e) { LOG.couldNotDeterminePriority(execution, value, e); }
public void execute(CommandContext commandContext) { LOG.debugAddingNewExclusiveJobToJobExecutorCOntext(jobId); jobExecutorContext.getCurrentProcessorJobQueue().add(jobId); logExclusiveJobAdded(commandContext); }
LOG.debugAcquiredJobNotFound(jobId); return null; throw LOG.jobNotFoundException(jobId);
public Void execute(CommandContext commandContext) { JobEntity job = commandContext .getJobManager() .findJobById(jobId); if (job != null) { fireHistoricJobFailedEvt(job); cmd.execute(commandContext); } else { LOG.debugFailedJobNotFound(jobId); } return null; } });
@Override protected void suspendAcquisition(long millis) { LOG.debugJobAcquisitionThreadSleeping(millis); if (jobExecutor instanceof ControllableJobExecutor) { ControllableJobExecutor controllableExecutor = (ControllableJobExecutor) jobExecutor; if (controllableExecutor.isSyncAsSuspendEnabled()) { controllableExecutor.getAcquisitionThreadControl().sync(); } } }
public void execute(CommandContext commandContext) { LOG.debugNotifyingJobExecutor("notifying job executor of new job"); jobExecutor.jobWasAdded(); } }
protected void initializeRetries(JobEntity job, int retries) { LOG.debugInitiallyAppyingRetryCycleForJob(job.getId(), retries); job.setRetries(retries); }
public Object execute(CommandContext commandContext) { JobEntity job = getJob(); ActivityImpl activity = getCurrentActivity(commandContext, job); if (activity == null) { LOG.debugFallbackToDefaultRetryStrategy(); executeStandardStrategy(commandContext); } else { try { executeCustomStrategy(commandContext, job, activity); } catch (Exception e) { LOG.debugFallbackToDefaultRetryStrategy(); executeStandardStrategy(commandContext); } } return null; }
public Void execute(CommandContext commandContext) { JobEntity job = getJob(); if (Context.getJobExecutorContext() == null) { EnsureUtil.ensureNotNull("Job with id " + jobId + " does not exist", "job", job); } else if (Context.getJobExecutorContext() != null && job == null) { // CAM-1842 // Job was acquired but does not exist anymore. This is not a problem. // It usually means that the job has been deleted after it was acquired which can happen if the // the activity instance corresponding to the job is cancelled. LOG.debugAcquiredJobNotFound(jobId); return null; } job.unlock(); return null; } }
protected AcquiredJobs acquireJobs( JobAcquisitionContext context, JobAcquisitionStrategy acquisitionStrategy, ProcessEngineImpl currentProcessEngine) { CommandExecutor commandExecutor = currentProcessEngine.getProcessEngineConfiguration() .getCommandExecutorTxRequired(); int numJobsToAcquire = acquisitionStrategy.getNumJobsToAcquire(currentProcessEngine.getName()); AcquiredJobs acquiredJobs = null; if (numJobsToAcquire > 0) { jobExecutor.logAcquisitionAttempt(currentProcessEngine); acquiredJobs = commandExecutor.execute(jobExecutor.getAcquireJobsCmd(numJobsToAcquire)); } else { acquiredJobs = new AcquiredJobs(numJobsToAcquire); } context.submitAcquiredJobs(currentProcessEngine.getName(), acquiredJobs); jobExecutor.logAcquiredJobs(currentProcessEngine, acquiredJobs.size()); jobExecutor.logAcquisitionFailureJobs(currentProcessEngine, acquiredJobs.getNumberOfJobsFailedToLock()); LOG.acquiredJobs(currentProcessEngine.getName(), acquiredJobs); return acquiredJobs; }
protected void executeCustomStrategy(CommandContext commandContext, JobEntity job, ActivityImpl activity) throws Exception { FailedJobRetryConfiguration retryConfiguration = getFailedJobRetryConfiguration(job, activity); if (retryConfiguration == null) { executeStandardStrategy(commandContext); } else { if (isFirstJobExecution(job)) { // then change default retries to the ones configured initializeRetries(job, retryConfiguration.getRetries()); } else { LOG.debugDecrementingRetriesForJob(job.getId()); } List<String> intervals = retryConfiguration.getRetryIntervals(); int intervalsCount = intervals.size(); int indexOfInterval = Math.max(0, Math.min(intervalsCount - 1, intervalsCount - (job.getRetries() - 1))); DurationHelper durationHelper = getDurationHelper(intervals.get(indexOfInterval)); job.setLockExpirationTime(durationHelper.getDateAfter()); logException(job); decrementRetries(job); notifyAcquisition(commandContext); } }
LOG.debugAcquiredJobNotFound(jobId); return null; throw LOG.jobNotFoundException(jobId);
public Void execute(CommandContext commandContext) { JobEntity job = commandContext .getJobManager() .findJobById(jobId); if (job != null) { fireHistoricJobFailedEvt(job); cmd.execute(commandContext); } else { LOG.debugFailedJobNotFound(jobId); } return null; } });
@Override protected void suspendAcquisition(long millis) { LOG.debugJobAcquisitionThreadSleeping(millis); if (jobExecutor instanceof ControllableJobExecutor) { ControllableJobExecutor controllableExecutor = (ControllableJobExecutor) jobExecutor; if (controllableExecutor.isSyncAsSuspendEnabled()) { controllableExecutor.getAcquisitionThreadControl().sync(); } } }
public void execute(CommandContext commandContext) { LOG.debugNotifyingJobExecutor("notifying job executor of new job"); jobExecutor.jobWasAdded(); } }
protected void initializeRetries(JobEntity job, int retries) { LOG.debugInitiallyAppyingRetryCycleForJob(job.getId(), retries); job.setRetries(retries); }
public Object execute(CommandContext commandContext) { JobEntity job = getJob(); ActivityImpl activity = getCurrentActivity(commandContext, job); if (activity == null) { LOG.debugFallbackToDefaultRetryStrategy(); executeStandardStrategy(commandContext); } else { try { executeCustomStrategy(commandContext, job, activity); } catch (Exception e) { LOG.debugFallbackToDefaultRetryStrategy(); executeStandardStrategy(commandContext); } } return null; }
public Void execute(CommandContext commandContext) { JobEntity job = getJob(); if (Context.getJobExecutorContext() == null) { EnsureUtil.ensureNotNull("Job with id " + jobId + " does not exist", "job", job); } else if (Context.getJobExecutorContext() != null && job == null) { // CAM-1842 // Job was acquired but does not exist anymore. This is not a problem. // It usually means that the job has been deleted after it was acquired which can happen if the // the activity instance corresponding to the job is cancelled. LOG.debugAcquiredJobNotFound(jobId); return null; } job.unlock(); return null; } }
protected AcquiredJobs acquireJobs( JobAcquisitionContext context, JobAcquisitionStrategy acquisitionStrategy, ProcessEngineImpl currentProcessEngine) { CommandExecutor commandExecutor = currentProcessEngine.getProcessEngineConfiguration() .getCommandExecutorTxRequired(); int numJobsToAcquire = acquisitionStrategy.getNumJobsToAcquire(currentProcessEngine.getName()); AcquiredJobs acquiredJobs = null; if (numJobsToAcquire > 0) { jobExecutor.logAcquisitionAttempt(currentProcessEngine); acquiredJobs = commandExecutor.execute(jobExecutor.getAcquireJobsCmd(numJobsToAcquire)); } else { acquiredJobs = new AcquiredJobs(numJobsToAcquire); } context.submitAcquiredJobs(currentProcessEngine.getName(), acquiredJobs); jobExecutor.logAcquiredJobs(currentProcessEngine, acquiredJobs.size()); jobExecutor.logAcquisitionFailureJobs(currentProcessEngine, acquiredJobs.getNumberOfJobsFailedToLock()); LOG.acquiredJobs(currentProcessEngine.getName(), acquiredJobs); return acquiredJobs; }