/** * Check to determine whether or not the JobExecution that is the parent of * the provided StepExecution has been interrupted. If, after synchronizing * the status with the database, the status has been updated to STOPPING, * then the job has been interrupted. * * @param stepExecution */ private void checkForInterruption(StepExecution stepExecution) { JobExecution jobExecution = stepExecution.getJobExecution(); jobExecutionDao.synchronizeStatus(jobExecution); if (jobExecution.isStopping()) { logger.info("Parent JobExecution is stopped, so passing message on to StepExecution"); stepExecution.setTerminateOnly(); } }
jobExplorer.getJobExecution(chunkContext.getStepContext().getStepExecution().getJobExecutionId()); if(jobExecution.isStopping()) { stopped = true;
if (execution.isRunning() || execution.isStopping()) { throw new JobExecutionAlreadyRunningException("A job execution for this job is already running: " + jobInstance);
/** * Test method for * {@link org.springframework.batch.core.JobExecution#getEndTime()}. */ @Test public void testIsRunningWithStoppedExecution() { execution.setStartTime(new Date()); assertTrue(execution.isRunning()); execution.stop(); assertTrue(execution.isRunning()); assertTrue(execution.isStopping()); }
@Override public StepExecution handleStep(Step step, JobExecution execution) throws JobInterruptedException, JobRestartException, StartLimitExceededException { if (execution.isStopping()) { throw new JobInterruptedException("JobExecution interrupted.");
private void checkForInterruption(StepExecution stepExecution) { JobExecution jobExecution = stepExecution.getJobExecution(); jobExecutionDao.synchronizeStatus(jobExecution); if (jobExecution.isStopping()) { logger.info("Parent JobExecution is stopped, so passing message on to StepExecution"); stepExecution.setTerminateOnly(); } }
/** * Check to determine whether or not the JobExecution that is the parent of * the provided StepExecution has been interrupted. If, after synchronizing * the status with the database, the status has been updated to STOPPING, * then the job has been interrupted. * * @param stepExecution */ private void checkForInterruption(StepExecution stepExecution) { JobExecution jobExecution = stepExecution.getJobExecution(); jobExecutionDao.synchronizeStatus(jobExecution); if (jobExecution.isStopping()) { logger.info("Parent JobExecution is stopped, so passing message on to StepExecution"); stepExecution.setTerminateOnly(); } }
@Override public synchronized Object read() throws JobInterruptedException { if (stopped || jobExecution.isStopping()) { return null; } Object read; try { read = eventReader.read(); if (read == null && jobExecution.isRunning()) { return FlushFlag.FORCE_FLUSH; } return read; } catch (InterruptedException e) { throw new JobInterruptedException(e.getMessage()); } }
/** * Check to determine whether or not the JobExecution that is the parent of * the provided StepExecution has been interrupted. If, after synchronizing * the status with the database, the status has been updated to STOPPING, * then the job has been interrupted. * * @param stepExecution */ private void checkForInterruption(StepExecution stepExecution) { JobExecution jobExecution = stepExecution.getJobExecution(); jobExecutionDao.synchronizeStatus(jobExecution); if (jobExecution.isStopping()) { logger.info("Parent JobExecution is stopped, so passing message on to StepExecution"); stepExecution.setTerminateOnly(); } }
/** * Check to determine whether or not the JobExecution that is the parent of * the provided StepExecution has been interrupted. If, after synchronizing * the status with the database, the status has been updated to STOPPING, * then the job has been interrupted. * * @param stepExecution */ private void checkForInterruption(StepExecution stepExecution) { JobExecution jobExecution = stepExecution.getJobExecution(); jobExecutionDao.synchronizeStatus(jobExecution); if (jobExecution.isStopping()) { logger.info("Parent JobExecution is stopped, so passing message on to StepExecution"); stepExecution.setTerminateOnly(); } }
if (jobExecution.isRunning() && !jobExecution.isStopping()) { try { jobStopper.stop(jobExecution.getId());
@Override @RequiresServiceRole(roleName = "WRITE") public void interrupt(final String pid) { try { final JobExecution jobExecution; Long jobInstanceId = JobIdentificationUtil.convertProcessIdIntoJobInstanceId(pid); jobExecution = processDataStorage.getJobExecution(jobInstanceId); if (jobExecution != null) { if (jobExecution.isRunning() && !jobExecution.isStopping()) { jobStopper.stop(jobExecution.getId()); } else { log.debug("Received interrupt signal, but jobExecution has already finished: {}", pid); } } else { log.warn("Retrieved interrupt signal but jobExecution is not found for process {}", pid); } } catch (JobExecutionNotRunningException e) { log.debug("Received interrupt signal, but jobExecution has already finished: {}", pid); } catch (final Exception e) { log.error(e.getMessage(), e); throw new GeneralServiceException(e, "Exception interrupting of the process {}", pid); } }
private void verifyProcessStatus(final Long jobInstanceId, final JobExecution jobExecution) { if (jobExecution == null) { throw new NoProcessException("Process {} does not exist. ", jobInstanceId); } if (jobExecution.isRunning() || jobExecution.isStopping()) { throw new ProcessStatusException("Process {} is still running or is stopping. Current status: {} ", jobInstanceId, jobExecution.getStatus()); } }
jobExplorer.getJobExecution(chunkContext.getStepContext().getStepExecution().getJobExecutionId()); if(jobExecution.isStopping()) { stopped = true;
jobExplorer.getJobExecution(chunkContext.getStepContext().getStepExecution().getJobExecutionId()); if(jobExecution.isStopping()) { stopped = true;
if (execution.isRunning() || execution.isStopping()) { throw new JobExecutionAlreadyRunningException("A job execution for this job is already running: " + jobInstance);
@Override public StepExecution handleStep(Step step, JobExecution execution) throws JobInterruptedException, JobRestartException, StartLimitExceededException { if (execution.isStopping()) { throw new JobInterruptedException("JobExecution interrupted.");
@Override public StepExecution handleStep(Step step, JobExecution execution) throws JobInterruptedException, JobRestartException, StartLimitExceededException { if (execution.isStopping()) { throw new JobInterruptedException("JobExecution interrupted.");
modelBuilder.addRow().addValue("End Time ").addValue(jobExecutionResource.getJobExecution().getEndTime()); modelBuilder.addRow().addValue("Running ").addValue(jobExecutionResource.getJobExecution().isRunning()); modelBuilder.addRow().addValue("Stopping ").addValue(jobExecutionResource.getJobExecution().isStopping()); modelBuilder.addRow().addValue("Step Execution Count ") .addValue(jobExecutionResource.getJobExecution().getStepExecutions().size());
modelBuilder.addRow().addValue("End Time ").addValue(jobExecutionResource.getJobExecution().getEndTime()); modelBuilder.addRow().addValue("Running ").addValue(jobExecutionResource.getJobExecution().isRunning()); modelBuilder.addRow().addValue("Stopping ").addValue(jobExecutionResource.getJobExecution().isStopping()); modelBuilder.addRow().addValue("Step Execution Count ") .addValue(jobExecutionResource.getJobExecution().getStepExecutions().size());