Java 类org.springframework.batch.core.launch.JobExecutionNotRunningException 实例源码

项目:spring-cloud-dataflow    文件:RestControllerAdvice.java   
/**
 * Log the exception message at warn level and stack trace as trace level. Return
 * response status HttpStatus.UNPROCESSABLE_ENTITY
 *
 * @param e one of the exceptions, {@link JobNotRestartableException} or
 * {@link JobExecutionNotRunningException}
 * @return the error response in JSON format with media type
 * application/vnd.error+json
 */
@ExceptionHandler({ JobNotRestartableException.class, JobExecutionNotRunningException.class })
@ResponseStatus(HttpStatus.UNPROCESSABLE_ENTITY)
@ResponseBody
public VndErrors onUnprocessableEntityException(Exception e) {
    String logref = logWarnLevelExceptionMessage(e);
    if (logger.isTraceEnabled()) {
        logTraceLevelStrackTrace(e);
    }
    String msg = getExceptionMessage(e);
    return new VndErrors(logref, msg);
}
项目:spring-batch-tools    文件:BatchController.java   
@RequestMapping("/executions/{executionId}/stop")
@ResponseBody
public JobExecution stopExecution(@PathVariable("executionId") final long executionId) throws NoSuchJobExecutionException,
        JobExecutionNotRunningException {
    batchOperator.stop(executionId);

    return execution(executionId);
}
项目:spring-batch-tools    文件:BatchOperatorImpl.java   
@Override
public void stop(final long executionId) throws NoSuchJobExecutionException, JobExecutionNotRunningException {
    final JobExecution jobExecution = execution(executionId);
    // Indicate the execution should be stopped by setting it's status to 'STOPPING'. It is assumed that the step implementation will
    // check this status at chunk boundaries.
    final BatchStatus status = jobExecution.getStatus();

    if (!(status == BatchStatus.STARTED || status == BatchStatus.STARTING)) {
        throw new JobExecutionNotRunningException("JobExecution must be running so that it can be stopped: " + jobExecution);
    }

    jobExecution.setStatus(BatchStatus.STOPPING);
    jobRepository.update(jobExecution);
}
项目:spring-boot-starter-batch-web    文件:JobOperationsController.java   
@RequestMapping(value = "/jobs/executions/{executionId}", method = RequestMethod.DELETE)
public String stop(@PathVariable long executionId) throws NoSuchJobExecutionException, JobExecutionNotRunningException {
    if (LOG.isDebugEnabled()) {
        LOG.debug("Stop JobExecution with id: " + executionId);
    }
    Boolean successful = jobOperator.stop(executionId);
    return successful.toString();
}
项目:spring-cloud-dataflow    文件:DefaultTaskJobService.java   
@Override
public void stopJobExecution(long jobExecutionId)
        throws NoSuchJobExecutionException, JobExecutionNotRunningException {
    this.jobService.stop(jobExecutionId).getStatus();
}
项目:spring-batch-tools    文件:BatchOperatorImplTest.java   
@Test(expected = JobExecutionNotRunningException.class)
public void stopExecutionNotRunningThrows() throws Exception {
    when(jobExplorer.getJobExecution(1L)).thenReturn(execution);
    when(execution.getStatus()).thenReturn(BatchStatus.COMPLETED);
    batchOperator.stop(1L);
}
项目:saos    文件:SaosJobServiceAdapter.java   
public JobExecution stop(Long jobExecutionId)
        throws NoSuchJobExecutionException, JobExecutionNotRunningException {
    return simpleJobService.stop(jobExecutionId);
}
项目:spring-boot-starter-batch-web    文件:JobOperationsController.java   
@ResponseStatus(HttpStatus.CONFLICT)
@ExceptionHandler(JobExecutionNotRunningException.class)
public String handleNotRunning(Exception ex) {
    LOG.warn("JobExecution is not running.",ex);
    return ex.getMessage();
}
项目:spring-cloud-dataflow    文件:JobExecutionController.java   
/**
 * Stop a Job Execution with the given jobExecutionId. Please be aware that you must
 * provide the request parameter {@code stop=true} in order to invoke this endpoint.
 *
 * @param jobExecutionId the executionId of the job execution to stop.
 * @throws JobExecutionNotRunningException if a stop is requested on a job that is not
 * running.
 * @throws NoSuchJobExecutionException if the job execution id specified does not
 * exist.
 */
@RequestMapping(value = { "/{executionId}" }, method = RequestMethod.PUT, params = "stop=true")
@ResponseStatus(HttpStatus.OK)
public void stopJobExecution(@PathVariable("executionId") long jobExecutionId)
        throws NoSuchJobExecutionException, JobExecutionNotRunningException {
    taskJobService.stopJobExecution(jobExecutionId);
}
项目:spring-cloud-dataflow    文件:TaskJobService.java   
/**
 * Requests a {@link JobExecution} to stop.
 * <p>
 * Please remember, that calling this method only requests a job execution to stop
 * processing. This method does not guarantee a {@link JobExecution} to stop. It is the
 * responsibility of the implementor of the {@link Job} to react to that request.
 * Furthermore, this method does not interfere with the associated {@link TaskExecution}.
 *
 * @param jobExecutionId The id of the {@link JobExecution} to stop
 * @throws NoSuchJobExecutionException if no job execution exists for the jobExecutionId.
 * @throws JobExecutionNotRunningException if a stop is requested on a job that is not
 * running.
 * @see org.springframework.batch.admin.service.JobService#stop(Long)
 */
void stopJobExecution(long jobExecutionId) throws NoSuchJobExecutionException, JobExecutionNotRunningException;
项目:egovframework.rte.root    文件:EgovBatchRunner.java   
/**
 * 실행 중인 Batch Job을 정지한다.
 * @param jobExecutionId : JobExecution의 ID
 * @throws NoSuchJobExecutionException
 * @throws JobExecutionNotRunningException
 */
public void stop(Long jobExecutionId) throws NoSuchJobExecutionException, JobExecutionNotRunningException  {
    jobOperator.stop(jobExecutionId);
}
项目:spring-batch-tools    文件:BatchOperator.java   
void stop(long executionId) throws NoSuchJobExecutionException, JobExecutionNotRunningException;