Package org.springframework.batch.core.repository

Examples of org.springframework.batch.core.repository.JobExecutionAlreadyRunningException


    }

    public JobExecution createJobExecution(String jobName, JobParameters jobParameters)
            throws JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException {
        if (isJobInstanceExists(jobName, jobParameters)) {
            throw new JobExecutionAlreadyRunningException("Job already executing");
        }

        return createJobExecutionInstance(jobName, jobParameters);
    }
View Full Code Here


  public JobExecution abandon(Long jobExecutionId) throws NoSuchJobExecutionException,
  JobExecutionAlreadyRunningException {

    JobExecution jobExecution = getJobExecution(jobExecutionId);
    if (jobExecution.getStatus().isLessThan(BatchStatus.STOPPING)) {
      throw new JobExecutionAlreadyRunningException(
          "JobExecution is running or complete and therefore cannot be aborted");
    }

    logger.info("Aborting job execution: " + jobExecution);
    jobExecution.upgradeStatus(BatchStatus.ABANDONED);
View Full Code Here

      logger.debug("Not synchronizing Job: " + jobName);
      return;
    }
    Set<JobExecution> running = jobExplorer.findRunningJobExecutions(jobName);
    if (!running.isEmpty()) {
      throw new JobExecutionAlreadyRunningException("An instance of this job is already active: "+jobName);
    }
    logger.debug("Job checked and no duplicates detected: " + jobName);
  }
View Full Code Here

      jobExecution.setEndTime(new Date());
      jobExecution.upgradeStatus(BatchStatus.ABANDONED);
      jobExecution.setExitStatus(jobExecution.getExitStatus().and(ExitStatus.NOOP).addExitDescription(
          "Not executed because another execution was detected for the same Job."));
      jobRepository.update(jobExecution);
      throw new JobExecutionAlreadyRunningException("An instance of this job is already active: "+jobName);
    }
  }
View Full Code Here

    public JobExecution run(Job job, JobParameters jobParameters) throws JobExecutionAlreadyRunningException {

      StubJobLauncher.jobParameters = jobParameters;

      if (throwExecutionRunningException) {
        throw new JobExecutionAlreadyRunningException("");
      }

      return jobExecution;
    }
View Full Code Here

  @Override
  public JobExecution abandon(long jobExecutionId) throws NoSuchJobExecutionException, JobExecutionAlreadyRunningException {
    JobExecution jobExecution = findExecutionById(jobExecutionId);

    if (jobExecution.getStatus().isLessThan(BatchStatus.STOPPING)) {
      throw new JobExecutionAlreadyRunningException(
          "JobExecution is running or complete and therefore cannot be aborted");
    }

    logger.info("Aborting job execution: " + jobExecution);
    jobExecution.upgradeStatus(BatchStatus.ABANDONED);
View Full Code Here

      List<JobExecution> executions = jobExecutionDao.findJobExecutions(jobInstance);

      // check for running executions and find the last started
      for (JobExecution execution : executions) {
        if (execution.isRunning()) {
          throw new JobExecutionAlreadyRunningException("A job execution for this job is already running: "
              + jobInstance);
        }

        BatchStatus status = execution.getStatus();
        if (execution.getJobParameters().getParameters().size() > 0 && (status == BatchStatus.COMPLETED || status == BatchStatus.ABANDONED)) {
View Full Code Here

TOP

Related Classes of org.springframework.batch.core.repository.JobExecutionAlreadyRunningException

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.