Package org.springframework.batch.core

Examples of org.springframework.batch.core.UnexpectedJobExecutionException


  private JobExecution launchJob(Job job, JobParameters jobParameters) {
    try {
      return this.launcher.run(job, jobParameters);
    }
    catch (JobExecutionAlreadyRunningException e) {
      throw new UnexpectedJobExecutionException("Step runner encountered exception.", e);
    }
    catch (JobRestartException e) {
      throw new UnexpectedJobExecutionException("Step runner encountered exception.", e);
    }
    catch (JobInstanceAlreadyCompleteException e) {
      throw new UnexpectedJobExecutionException("Step runner encountered exception.", e);
    }
    catch (JobParametersInvalidException e) {
      throw new UnexpectedJobExecutionException("Step runner encountered exception.", e);
    }
  }
View Full Code Here


  @Override
  public T read() throws Exception {

    counter++;
    if (counter == throwExceptionOnRecordNumber) {
      throw new UnexpectedJobExecutionException("Planned failure on count=" + counter);
    }

    return delegate.read();
  }
View Full Code Here

    }

    JobExecution jobExecution = jobLauncher.run(job, jobParameters);
    if (jobExecution.getStatus().isUnsuccessful()) {
      // AbstractStep will take care of the step execution status
      throw new UnexpectedJobExecutionException("Step failure: the delegate Job failed in JobStep.");
    }

  }
View Full Code Here

    logger.info(String.format("Attempting to resume job with name=%s and parameters=%s", jobName, parameters));
    try {
      return jobLauncher.run(job, parameters).getId();
    }
    catch (JobExecutionAlreadyRunningException e) {
      throw new UnexpectedJobExecutionException(String.format(ILLEGAL_STATE_MSG, "job execution already running",
          jobName, parameters), e);
    }

  }
View Full Code Here

    logger.info(String.format("Attempting to launch job with name=%s and parameters=%s", jobName, parameters));
    try {
      return jobLauncher.run(job, jobParameters).getId();
    }
    catch (JobExecutionAlreadyRunningException e) {
      throw new UnexpectedJobExecutionException(String.format(ILLEGAL_STATE_MSG, "job execution already running",
          jobName, parameters), e);
    }
    catch (JobRestartException e) {
      throw new UnexpectedJobExecutionException(String.format(ILLEGAL_STATE_MSG, "job not restartable", jobName,
          parameters), e);
    }
    catch (JobInstanceAlreadyCompleteException e) {
      throw new UnexpectedJobExecutionException(String.format(ILLEGAL_STATE_MSG, "job already complete", jobName,
          parameters), e);
    }

  }
View Full Code Here

    logger.info(String.format("Attempting to launch job with name=%s and parameters=%s", jobName, parameters));
    try {
      return jobLauncher.run(job, parameters).getId();
    }
    catch (JobExecutionAlreadyRunningException e) {
      throw new UnexpectedJobExecutionException(String.format(ILLEGAL_STATE_MSG, "job already running", jobName,
          parameters), e);
    }
    catch (JobRestartException e) {
      throw new UnexpectedJobExecutionException(String.format(ILLEGAL_STATE_MSG, "job not restartable", jobName,
          parameters), e);
    }
    catch (JobInstanceAlreadyCompleteException e) {
      throw new UnexpectedJobExecutionException(String.format(ILLEGAL_STATE_MSG, "job instance already complete",
          jobName, parameters), e);
    }

  }
View Full Code Here

    Exception error = errors.get(0);
    if (error instanceof RuntimeException) {
      throw (RuntimeException) error;
    }
    else {
      throw new UnexpectedJobExecutionException("Could not close step context, rethrowing first of "
          + errors.size() + " exceptions.", error);
    }
  }
View Full Code Here

    Exception error = errors.get(0);
    if (error instanceof RuntimeException) {
      throw (RuntimeException) error;
    } else {
      throw new UnexpectedJobExecutionException("Could not close step context, rethrowing first of "
          + errors.size() + " exceptions.", error);
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.batch.core.UnexpectedJobExecutionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.