Example usage for org.springframework.batch.core.launch.support ExitCodeMapper NO_SUCH_JOB

List of usage examples for org.springframework.batch.core.launch.support ExitCodeMapper NO_SUCH_JOB

Introduction

In this page you can find the example usage for org.springframework.batch.core.launch.support ExitCodeMapper NO_SUCH_JOB.

Prototype

String NO_SUCH_JOB

To view the source code for org.springframework.batch.core.launch.support ExitCodeMapper NO_SUCH_JOB.

Click Source Link

Usage

From source file:org.springframework.batch.core.job.AbstractJob.java

/**
 * Default mapping from throwable to {@link ExitStatus}.
 *
 * @param ex//from   ww w  .  j av  a2 s  . c o m
 *            the cause of the failure
 * @return an {@link ExitStatus}
 */
protected ExitStatus getDefaultExitStatusForFailure(Throwable ex, JobExecution execution) {
    ExitStatus exitStatus;
    if (ex instanceof JobInterruptedException || ex.getCause() instanceof JobInterruptedException) {
        exitStatus = ExitStatus.STOPPED.addExitDescription(JobInterruptedException.class.getName());
    } else if (ex instanceof NoSuchJobException || ex.getCause() instanceof NoSuchJobException) {
        exitStatus = new ExitStatus(ExitCodeMapper.NO_SUCH_JOB, ex.getClass().getName());
    } else {
        exitStatus = ExitStatus.FAILED.addExitDescription(ex);
    }

    return exitStatus;
}

From source file:org.springframework.batch.core.launch.support.SimpleJvmExitCodeMapper.java

public SimpleJvmExitCodeMapper() {
    mapping = new HashMap<String, Integer>();
    mapping.put(ExitStatus.COMPLETED.getExitCode(), JVM_EXITCODE_COMPLETED);
    mapping.put(ExitStatus.FAILED.getExitCode(), JVM_EXITCODE_GENERIC_ERROR);
    mapping.put(ExitCodeMapper.JOB_NOT_PROVIDED, JVM_EXITCODE_JOB_ERROR);
    mapping.put(ExitCodeMapper.NO_SUCH_JOB, JVM_EXITCODE_JOB_ERROR);
}

From source file:org.springframework.batch.core.step.AbstractStep.java

/**
 * Default mapping from throwable to {@link ExitStatus}. Clients can modify the exit code using a
 * {@link StepExecutionListener}./*from   w w  w . j a  v  a2s. com*/
 *
 * @param ex the cause of the failure
 * @return an {@link ExitStatus}
 */
private ExitStatus getDefaultExitStatusForFailure(Throwable ex) {
    ExitStatus exitStatus;
    if (ex instanceof JobInterruptedException || ex.getCause() instanceof JobInterruptedException) {
        exitStatus = ExitStatus.STOPPED.addExitDescription(JobInterruptedException.class.getName());
    } else if (ex instanceof NoSuchJobException || ex.getCause() instanceof NoSuchJobException) {
        exitStatus = new ExitStatus(ExitCodeMapper.NO_SUCH_JOB, ex.getClass().getName());
    } else {
        exitStatus = ExitStatus.FAILED.addExitDescription(ex);
    }

    return exitStatus;
}