Package org.springframework.batch.core

Examples of org.springframework.batch.core.JobExecutionException


      log.info("Modified jobParameters=" + jobParameters);
    }

    if (jobProperties != null && jobProperties.isRestart()) {
      if (jobExplorer == null) {
        throw new JobExecutionException("A JobExplorer must be provided for a restart or start next operation.");
      }
      JobExecution jobExecution = getLastFailedJobExecution(jobIdentifier);
      if (log.isDebugEnabled()) {
        log.info("Last failed JobExecution: " + jobExecution);
      }
      if (jobExecution == null && jobProperties.isFailRestart()) {
        throw new JobExecutionNotFailedException("No failed or stopped execution found for job="
            + jobIdentifier);
      } else {
        log.info("No failed or stopped execution found for job=" + jobIdentifier
            + ", batch properties flag for failRestart=" + jobProperties.isFailRestart()
            + " so we don't fail restart.");
      }
      if (jobExecution != null) {
        restart = true;
        jobParameters = jobExecution.getJobParameters();
      }
    }

    if (jobProperties != null && jobProperties.isNext() && !restart) {
      if (jobExplorer == null) {
        throw new JobExecutionException("A JobExplorer must be provided for a restart or start next operation.");
      }
      JobParameters nextParameters = getNextJobParameters(job, false);
      Map<String, JobParameter> map = new HashMap<String, JobParameter>(nextParameters.getParameters());
      map.putAll(jobParameters.getParameters());
      jobParameters = new JobParameters(map);
View Full Code Here


    }
    catch (FlowExecutionException e) {
      if (e.getCause() instanceof JobExecutionException) {
        throw (JobExecutionException) e.getCause();
      }
      throw new JobExecutionException("Flow execution ended unexpectedly", e);
    }
  }
View Full Code Here

    }
    catch (FlowExecutionException e) {
      if (e.getCause() instanceof JobExecutionException) {
        throw (JobExecutionException) e.getCause();
      }
      throw new JobExecutionException("Flow execution ended unexpectedly", e);
    }
  }
View Full Code Here

    }

    BatchStatus stepStatus = lastStepExecution.getStatus();

    if (stepStatus == BatchStatus.UNKNOWN) {
      throw new JobExecutionException("Cannot restart step from UNKNOWN status.  "
          + "The last execution ended with a failure that could not be rolled back, "
          + "so it may be dangerous to proceed.  " + "Manual intervention is probably necessary.");
    }

    if (stepStatus == BatchStatus.COMPLETED) {
      if (!allowStartIfComplete) {
        if (isSameJobExecution(stepExecution, lastStepExecution)) {
          // it's always OK to start again in the same JobExecution
          return true;
        }
        // step is complete, false should be returned, indicating that
        // the step should not be started
        return false;
      }
      else {
        return true;
      }
    }

    if (stepStatus == BatchStatus.STOPPED || stepStatus == BatchStatus.FAILED) {
      return true;
    }

    if (stepStatus == BatchStatus.STARTED || stepStatus == BatchStatus.STARTING
        || stepStatus == BatchStatus.STOPPING) {
      throw new JobExecutionException(
          "Cannot restart step from "
              + stepStatus
              + " status.  "
              + "The old execution may still be executing, so you may need to verify manually that this is the case.");
    }

    throw new JobExecutionException("Cannot restart step from " + stepStatus + " status.  "
        + "We believe the old execution was abandoned and therefore has been marked as un-restartable.");

  }
View Full Code Here

    stepExecution.upgradeStatus(BatchStatus.COMPLETED);
    stepExecutionAggregator.aggregate(stepExecution, executions);

    // If anything failed or had a problem we need to crap out
    if (stepExecution.getStatus().isUnsuccessful()) {
      throw new JobExecutionException("Partition handler returned an unsuccessful step");
    }
  }
View Full Code Here

    if (stepExecution.getStatus().isUnsuccessful()) {
      if (hasReducer) {
        reducer.rollbackPartitionedStep();
        reducer.afterPartitionedStepCompletion(PartitionStatus.ROLLBACK);
      }
      throw new JobExecutionException("Partition handler returned an unsuccessful step");
    }

    if (hasReducer) {
      reducer.beforePartitionedStepCompletion();
      reducer.afterPartitionedStepCompletion(PartitionStatus.COMMIT);
View Full Code Here

    }
    catch (FlowExecutionException e) {
      if (e.getCause() instanceof JobExecutionException) {
        throw (JobExecutionException) e.getCause();
      }
      throw new JobExecutionException("Flow execution ended unexpectedly", e);
    }
  }
View Full Code Here

        startState = ((DelegateState) startState).getState();
      } else if(startState instanceof JsrStepState) {
        String stepName = startState.getName().substring(startState.getName().indexOf(".") + 1, startState.getName().length());
        Step step = ((JsrStepState) startState).getStep(stepName);
        if(step instanceof DecisionStep) {
          throw new JobExecutionException("Decision step is an invalid first step");
        } else {
          break;
        }
      } else if(startState instanceof FlowState){
        Flow firstFlow = ((FlowState) startState).getFlows().iterator().next();
View Full Code Here

TOP

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

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.