Example usage for org.springframework.batch.core.repository JobExecutionAlreadyRunningException getMessage

List of usage examples for org.springframework.batch.core.repository JobExecutionAlreadyRunningException getMessage

Introduction

In this page you can find the example usage for org.springframework.batch.core.repository JobExecutionAlreadyRunningException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.ifeng.computing.batch.BatchJobTest.java

@Test
public void create() {

    try {//from  w ww. j  av a  2  s  .c o  m
        JobExecution execution = jobLauncher.run(reportJob, new JobParameters());

        log.info(">>>>>>>>>>>>>>> result: " + execution.getStatus());

        Assert.assertEquals(BatchStatus.COMPLETED, execution.getStatus());

    } catch (JobExecutionAlreadyRunningException e) {
        log.error(e.getMessage(), e);
    } catch (JobRestartException e) {
        log.error(e.getMessage(), e);
    } catch (JobInstanceAlreadyCompleteException e) {
        log.error(e.getMessage(), e);
    } catch (JobParametersInvalidException e) {
        log.error(e.getMessage(), e);
    }

}

From source file:com.ifeng.computing.batch.BatchJobTest.java

@Test
public void createNewsJob() {

    try {//  www  .jav  a2 s.  c  o m
        JobExecution execution = jobLauncher.run(createNewsJob, new JobParameters());

        log.info(">>>>>>>>>>>>>>> result: " + execution.getStatus());

        Assert.assertEquals(BatchStatus.COMPLETED, execution.getStatus());

    } catch (JobExecutionAlreadyRunningException e) {
        log.error(e.getMessage(), e);
    } catch (JobRestartException e) {
        log.error(e.getMessage(), e);
    } catch (JobInstanceAlreadyCompleteException e) {
        log.error(e.getMessage(), e);
    } catch (JobParametersInvalidException e) {
        log.error(e.getMessage(), e);
    }

}

From source file:com.ifeng.computing.batch.BatchJobTest.java

@Test
public void logDataFormatJob() {

    try {//from  w  w w  .  j  a  va  2  s .c  o m
        JobExecution execution = jobLauncher.run(logDataFormatJob, new JobParameters());

        log.info(">>>>>>>>>>>>>>> result: " + execution.getStatus());

        Assert.assertEquals(BatchStatus.COMPLETED, execution.getStatus());

    } catch (JobExecutionAlreadyRunningException e) {
        log.error(e.getMessage(), e);
    } catch (JobRestartException e) {
        log.error(e.getMessage(), e);
    } catch (JobInstanceAlreadyCompleteException e) {
        log.error(e.getMessage(), e);
    } catch (JobParametersInvalidException e) {
        log.error(e.getMessage(), e);
    }

}

From source file:com.ifeng.computing.batch.BatchJobTest.java

@Test
public void partitionReadNewsItemJob() {

    try {/*from  w w w. j  av  a 2 s  .  c o m*/

        JobExecution execution = jobLauncher.run(partitionReadNewsItemJob, new JobParameters());

        log.info(">>>>>>>>>>>>>>> result: " + execution.getStatus());

        Assert.assertEquals(BatchStatus.COMPLETED, execution.getStatus());

    } catch (JobExecutionAlreadyRunningException e) {
        log.error(e.getMessage(), e);
    } catch (JobRestartException e) {
        log.error(e.getMessage(), e);
    } catch (JobInstanceAlreadyCompleteException e) {
        log.error(e.getMessage(), e);
    } catch (JobParametersInvalidException e) {
        log.error(e.getMessage(), e);
    }

}

From source file:com.ifeng.computing.batch.BatchJobTest.java

@Test
public void logDataProcessor() {

    try {/* ww  w. jav a2 s .  c om*/

        JobExecution execution = jobLauncher.run(logDataProcessor, new JobParameters());

        log.info(">>>>>>>>>>>>>>> result: " + execution.getStatus());

        Assert.assertEquals(BatchStatus.COMPLETED, execution.getStatus());

    } catch (JobExecutionAlreadyRunningException e) {
        log.error(e.getMessage(), e);
    } catch (JobRestartException e) {
        log.error(e.getMessage(), e);
    } catch (JobInstanceAlreadyCompleteException e) {
        log.error(e.getMessage(), e);
    } catch (JobParametersInvalidException e) {
        log.error(e.getMessage(), e);
    }

}

From source file:com.ifeng.computing.batch.BatchJobTest.java

@Test
public void parallelWriteJob() {

    try {/*  w  w w .  jav  a  2  s  . c o m*/

        JobExecution execution = jobLauncher.run(parallelWriteJob, new JobParameters());

        log.info(">>>>>>>>>>>>>>> result: " + execution.getStatus());

        Assert.assertEquals(BatchStatus.COMPLETED, execution.getStatus());

    } catch (JobExecutionAlreadyRunningException e) {
        log.error(e.getMessage(), e);
    } catch (JobRestartException e) {
        log.error(e.getMessage(), e);
    } catch (JobInstanceAlreadyCompleteException e) {
        log.error(e.getMessage(), e);
    } catch (JobParametersInvalidException e) {
        log.error(e.getMessage(), e);
    }

}

From source file:com.ifeng.computing.batch.BatchJobTest.java

@Test
public void logDataFormatJobWithParameters() {

    try {//  ww w  . jav a2 s .  c  om
        Map<String, JobParameter> jobParameters = new HashMap<String, JobParameter>();
        jobParameters.put("inputFile", new JobParameter("data/log-data.json"));

        JobExecution execution = jobLauncher.run(logDataFormatJob, new JobParameters(jobParameters));

        log.info(">>>>>>>>>>>>>>> result: " + execution.getStatus());

        Assert.assertEquals(BatchStatus.COMPLETED, execution.getStatus());

    } catch (JobExecutionAlreadyRunningException e) {
        log.error(e.getMessage(), e);
    } catch (JobRestartException e) {
        log.error(e.getMessage(), e);
    } catch (JobInstanceAlreadyCompleteException e) {
        log.error(e.getMessage(), e);
    } catch (JobParametersInvalidException e) {
        log.error(e.getMessage(), e);
    }

}

From source file:org.springframework.batch.admin.web.RestControllerAdvice.java

@ResponseBody
@ExceptionHandler//from www.j  a  va  2s.c om
@ResponseStatus(HttpStatus.BAD_REQUEST)
public VndErrors onJobExecutionAlreadyRunningException(JobExecutionAlreadyRunningException e) {
    String logref = logDebug(e);
    return new VndErrors(logref, e.getMessage());
}