Package org.springframework.batch.repeat

Examples of org.springframework.batch.repeat.RepeatOperations


  @Override
  protected Tasklet createTasklet() {
    Assert.state(reader != null, "ItemReader must be provided");
    Assert.state(processor != null || writer != null, "ItemWriter or ItemProcessor must be provided");
    RepeatOperations repeatOperations = createChunkOperations();
    SimpleChunkProvider<I> chunkProvider = new SimpleChunkProvider<I>(reader, repeatOperations);
    SimpleChunkProcessor<I, O> chunkProcessor = new SimpleChunkProcessor<I, O>(processor, writer);
    chunkProvider.setListeners(new ArrayList<StepListener>(itemListeners));
    chunkProcessor.setListeners(new ArrayList<StepListener>(itemListeners));
    ChunkOrientedTasklet<I> tasklet = new ChunkOrientedTasklet<I>(chunkProvider, chunkProcessor);
View Full Code Here


    this.chunkOperations = repeatTemplate;
    return this;
  }

  protected RepeatOperations createChunkOperations() {
    RepeatOperations repeatOperations = chunkOperations;
    if (repeatOperations == null) {
      RepeatTemplate repeatTemplate = new RepeatTemplate();
      repeatTemplate.setCompletionPolicy(getChunkCompletionPolicy());
      repeatOperations = repeatTemplate;
    }
View Full Code Here

    factory.setItemReader(new ListItemReader<String>(new ArrayList<String>()));
    factory.setItemWriter(new EmptyItemWriter<String>());
    factory.setJobRepository(new JobRepositorySupport());
    factory.setTransactionManager(new ResourcelessTransactionManager());

    factory.setStepOperations(new RepeatOperations() {

      @Override
      public RepeatStatus iterate(RepeatCallback callback) {
        list = new ArrayList<String>();
        list.add("foo");
View Full Code Here

  @Override
  protected Tasklet createTasklet() {
    Assert.state(getReader() != null, "ItemReader must be provided");
    Assert.state(getProcessor() != null || getWriter() != null, "ItemWriter or ItemProcessor must be provided");
    RepeatOperations repeatOperations = createRepeatOperations();
    ChunkProvider<I> chunkProvider = new JsrChunkProvider<I>();
    JsrChunkProcessor<I, O> chunkProcessor = new JsrChunkProcessor<I, O>(getReader(), getProcessor(), getWriter(), repeatOperations);
    chunkProcessor.setListeners(new ArrayList<StepListener>(getItemListeners()));
    ChunkOrientedTasklet<I> tasklet = new ChunkOrientedTasklet<I>(chunkProvider, chunkProcessor);
    tasklet.setBuffering(!isReaderTransactionalQueue());
View Full Code Here

      batchRetryTemplate.setBackOffPolicy(backOffPolicy);
    }
    batchRetryTemplate.setRetryPolicy(retryPolicyWrapper);

    // Coordinate the retry policy with the exception handler:
    RepeatOperations stepOperations = getStepOperations();
    if (stepOperations instanceof RepeatTemplate) {
      SimpleRetryExceptionHandler exceptionHandler = new SimpleRetryExceptionHandler(retryPolicyWrapper,
          getExceptionHandler(), nonRetryableExceptionClasses);
      ((RepeatTemplate) stepOperations).setExceptionHandler(exceptionHandler);
    }
View Full Code Here

    assertEquals(1, target.count);
  }

  public void testSetTemplate() throws Exception {
    final List<Object> calls = new ArrayList<Object>();
    interceptor.setRepeatOperations(new RepeatOperations() {
            @Override
      public RepeatStatus iterate(RepeatCallback callback) {
        try {
          Object result = callback.doInIteration(null);
          calls.add(result);
View Full Code Here

    assertEquals(1, calls.size());
  }

  public void testCallbackNotExecuted() throws Exception {
    final List<Object> calls = new ArrayList<Object>();
    interceptor.setRepeatOperations(new RepeatOperations() {
            @Override
      public RepeatStatus iterate(RepeatCallback callback) {
        calls.add(null);
        return RepeatStatus.FINISHED;
      }
View Full Code Here

TOP

Related Classes of org.springframework.batch.repeat.RepeatOperations

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.