Package org.springframework.batch.core

Examples of org.springframework.batch.core.BatchStatus


        return createJobExecutionInstance(jobName, jobParameters);
    }

    public void update(JobExecution jobExecution) {
        BatchStatus status = jobExecution.getStatus();
        JobInstance instance = jobExecution.getJobInstance();
        String jobName = instance.getJobName();
        if (BatchStatus.STARTING.equals(status)) {
            Assert.assertNull("Multiple executions for job=" + jobName, execsMap.put(jobName, jobExecution));
        } else if (BatchStatus.COMPLETED.equals(status)
View Full Code Here


    final JobExecution jobExecution = parent.getBean(JobLauncher.class).run(job,
        new JobParametersBuilder().addString("fail", "false").toJobParameters());

    new DirectPoller<BatchStatus>(100).poll(new Callable<BatchStatus>() {
      public BatchStatus call() throws Exception {
        BatchStatus status = jobExecution.getStatus();
        if (status.isLessThan(BatchStatus.STOPPED) && status!=BatchStatus.COMPLETED) {
          return null;
        }
        return status;
      }
    }).get(2000, TimeUnit.MILLISECONDS);
View Full Code Here

    Job job = child.getBean(Job.class);
    final JobExecution jobExecution = parent.getBean(JobLauncher.class).run(job, new JobParameters());

    new DirectPoller<BatchStatus>(100).poll(new Callable<BatchStatus>() {
      public BatchStatus call() throws Exception {
        BatchStatus status = jobExecution.getStatus();
        if (status.isLessThan(BatchStatus.STOPPED) && status != BatchStatus.COMPLETED) {
          return null;
        }
        return status;
      }
    }).get(2000, TimeUnit.MILLISECONDS);
View Full Code Here

    assertEquals(jobExecution.getJobId(), newExecution.getJobId());
    Future<BatchStatus> poll = new DirectPoller<BatchStatus>(100L).poll(new Callable<BatchStatus>() {
      public BatchStatus call() throws Exception {
        JobExecution jobExecution = jobExplorer.getJobExecution(newExecution.getId());
        BatchStatus status = jobExecution.getStatus();
        return jobExecution.isRunning() ? null : status;
      }
    });
    assertEquals(BatchStatus.COMPLETED, poll.get(1000, TimeUnit.MILLISECONDS));
View Full Code Here

        assertEquals(jobExecution.getJobId(), newExecution.getJobId());
        Future<BatchStatus> poll = new DirectPoller<BatchStatus>(100L).poll(new Callable<BatchStatus>() {
          public BatchStatus call() throws Exception {
            JobExecution jobExecution = jobExplorer.getJobExecution(newExecution.getId());
            BatchStatus status = jobExecution.getStatus();
            return jobExecution.isRunning() ? null : status;
          }
        });
        assertEquals(BatchStatus.COMPLETED, poll.get(1000, TimeUnit.MILLISECONDS));
View Full Code Here

        assertEquals(jobExecution.getJobId(), newExecution.getJobId());
        Future<BatchStatus> poll = new DirectPoller<BatchStatus>(100L).poll(new Callable<BatchStatus>() {
          public BatchStatus call() throws Exception {
            JobExecution jobExecution = jobExplorer.getJobExecution(newExecution.getId());
            BatchStatus status = jobExecution.getStatus();
            return jobExecution.isRunning() ? null : status;
          }
        });
        assertEquals(BatchStatus.COMPLETED, poll.get(1000, TimeUnit.MILLISECONDS));
View Full Code Here

    Job job = jobLocator.getJob(jobName);

    JobExecution lastJobExecution = jobRepository.getLastJobExecution(jobName, jobParameters);
    boolean restart = false;
    if (lastJobExecution != null) {
      BatchStatus status = lastJobExecution.getStatus();
      if (status.isUnsuccessful() && status!=BatchStatus.ABANDONED) {
        restart = true;
      }
    }

    if (job.getJobParametersIncrementer() != null && !restart) {
View Full Code Here

      public JsonWrapper call() throws Exception {
        RestTemplate template = new RestTemplate();
        ResponseEntity<String> result = template.exchange(resource, HttpMethod.GET, null, String.class);
        JsonWrapper wrapper = new JsonWrapper(result.getBody());
        // System.err.println(wrapper);
        BatchStatus status = wrapper.get("jobExecution.status", BatchStatus.class);
        return status.isGreaterThan(BatchStatus.STOPPING) ? wrapper : null;
      }
    });
    JsonWrapper jobExecution = poll.get(500L, TimeUnit.MILLISECONDS);
    assertNotNull(jobExecution);

    BatchStatus status = jobExecution.get("jobExecution.status", BatchStatus.class);
    assertEquals(BatchStatus.STOPPED, status);

  }
View Full Code Here

    this.jobParametersString = new JobParametersExtractor().fromJobParameters(jobExecution.getJobParameters());

    JobInstance jobInstance = jobExecution.getJobInstance();
    if (jobInstance != null) {
      this.jobName = jobInstance.getJobName();
      BatchStatus status = jobExecution.getStatus();
      this.restartable = status.isGreaterThan(BatchStatus.STOPPING) && status.isLessThan(BatchStatus.ABANDONED);
      this.abandonable = status.isGreaterThan(BatchStatus.STARTED) && status!=BatchStatus.ABANDONED;
      this.stoppable  = status.isLessThan(BatchStatus.STOPPING);
    }
    else {
      this.jobName = "?";
    }
View Full Code Here

    if (lastStepExecution == null) {
      return true;
    }

    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.");
View Full Code Here

TOP

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

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.