Package org.springframework.batch.core.step.tasklet

Examples of org.springframework.batch.core.step.tasklet.Tasklet


  }

  @Test
  public void testRepositoryErrorOnUpdateStepExecutionInTransaction() throws Exception {

    taskletStep.setTasklet(new Tasklet() {

      @Override
      public RepeatStatus execute(StepContribution contribution, ChunkContext attributes) throws Exception {
        return RepeatStatus.FINISHED;
      }
View Full Code Here


  }

  @Test
  public void testRepositoryErrorOnUpdateStepExecutionInTransactionRollbackFailed() throws Exception {

    taskletStep.setTasklet(new Tasklet() {

      @Override
      public RepeatStatus execute(StepContribution contribution, ChunkContext attributes) throws Exception {
        return RepeatStatus.FINISHED;
      }
View Full Code Here

  }

  @Test
  public void testRepositoryErrorOnFailure() throws Exception {

    taskletStep.setTasklet(new Tasklet() {

      @Override
      public RepeatStatus execute(StepContribution contribution, ChunkContext attributes) throws Exception {
        throw new RuntimeException("Tasklet exception");
      }
View Full Code Here

    jobLauncher.setTaskExecutor(new SimpleAsyncTaskExecutor());
    jobLauncher.afterPropertiesSet();

    SimpleJob job = new SimpleJob("job");
    TaskletStep step = new TaskletStep("step");
    step.setTasklet(new Tasklet() {
      @Override
      public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
        while (block) {
          Thread.sleep(100L);
        }
View Full Code Here

      return steps.get("step2").tasklet(tasklet()).build();
    }

    @Bean
    protected Tasklet tasklet() {
      return new Tasklet() {
        @Override
        public RepeatStatus execute(StepContribution contribution, ChunkContext context) throws Exception {
          if (fail) {
            throw new RuntimeException("Planned!");
          }
View Full Code Here

          if (stepExecution.getStatus().isRunning()) {
            try {
              //have the step execution that's running -> need to 'stop' it
              Step step = ((StepLocator)job).getStep(stepExecution.getStepName());
              if (step instanceof TaskletStep) {
                Tasklet tasklet = ((TaskletStep)step).getTasklet();
                if (tasklet instanceof StoppableTasklet) {
                  StepSynchronizationManager.register(stepExecution);
                  ((StoppableTasklet)tasklet).stop();
                  StepSynchronizationManager.release();
                }
View Full Code Here

          if (stepExecution.getStatus().isRunning()) {
            try {
              //have the step execution that's running -> need to 'stop' it
              Step step = ((StepLocator)job).getStep(stepExecution.getStepName());
              if (step instanceof TaskletStep) {
                Tasklet tasklet = ((TaskletStep)step).getTasklet();
                if (tasklet instanceof StoppableTasklet) {
                  StepSynchronizationManager.register(stepExecution);
                  ((StoppableTasklet)tasklet).stop();
                  StepSynchronizationManager.release();
                }
View Full Code Here

    @Autowired
    public StepBuilderFactory stepBuilderFactory;

    @Bean
    public Step step() {
      return stepBuilderFactory.get("step1").tasklet(new Tasklet() {
        @Override
        public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
          return null;
        }
      }).build();
View Full Code Here

  @Autowired
  private StepBuilderFactory steps;

  @Bean
  protected Tasklet tasklet() {
    return new Tasklet() {
      @Override
      public RepeatStatus execute(StepContribution contribution,
          ChunkContext context) {
        return RepeatStatus.FINISHED;
      }
View Full Code Here

    this.jobLauncher = this.context.getBean(JobLauncher.class);
    this.jobs = new JobBuilderFactory(jobRepository);
    PlatformTransactionManager transactionManager = this.context
        .getBean(PlatformTransactionManager.class);
    this.steps = new StepBuilderFactory(jobRepository, transactionManager);
    this.step = this.steps.get("step").tasklet(new Tasklet() {
      @Override
      public RepeatStatus execute(StepContribution contribution,
          ChunkContext chunkContext) throws Exception {
        return null;
      }
View Full Code Here

TOP

Related Classes of org.springframework.batch.core.step.tasklet.Tasklet

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.