Package org.springframework.batch.repeat

Examples of org.springframework.batch.repeat.RepeatCallback


            @Override
      public void before(RepeatContext context) {
        calls.add("2");
      }
    } });
    template.iterate(new RepeatCallback() {
            @Override
      public RepeatStatus doInIteration(RepeatContext context) throws Exception {
        count++;
        return RepeatStatus.continueIf(count <= 1);
      }
View Full Code Here


  @Test
  public void testNestedSessionTerminatesBeforeIteration() throws Exception {
    RepeatTemplate outer = getRepeatTemplate();
    RepeatTemplate inner = getRepeatTemplate();
    outer.iterate(new NestedRepeatCallback(inner, new RepeatCallback() {
            @Override
      public RepeatStatus doInIteration(RepeatContext context) throws Exception {
        count++;
        assertEquals(2, count);
        fail("Nested batch should not have been executed");
View Full Code Here

      public void before(RepeatContext context) {
        calls.add("1");
        context.setCompleteOnly();
      }
    });
    template.iterate(new RepeatCallback() {
            @Override
      public RepeatStatus doInIteration(RepeatContext context) throws Exception {
        count++;
        return RepeatStatus.FINISHED;
      }
View Full Code Here

  @Test
  public void testOuterContextPreserved() throws Exception {
    RepeatTemplate outer = getRepeatTemplate();
    outer.setCompletionPolicy(new SimpleCompletionPolicy(2));
    RepeatTemplate inner = getRepeatTemplate();
    outer.iterate(new NestedRepeatCallback(inner, new RepeatCallback() {
            @Override
      public RepeatStatus doInIteration(RepeatContext context) throws Exception {
        count++;
        assertNotNull(context);
        assertNotSame("Nested batch should have new session", context, context.getParent());
View Full Code Here

            @Override
      public void after(RepeatContext context, RepeatStatus result) {
        calls.add("2");
      }
    } });
    template.iterate(new RepeatCallback() {
            @Override
      public RepeatStatus doInIteration(RepeatContext context) throws Exception {
        count++;
        return RepeatStatus.continueIf(count <= 1);
      }
View Full Code Here

  @Test
  public void testExceptionThrownOnLastItem() throws Exception {
    template.setCompletionPolicy(new SimpleCompletionPolicy(2));
    try {
      template.iterate(new RepeatCallback() {
                @Override
        public RepeatStatus doInIteration(RepeatContext context) throws Exception {
          count++;
          if (count < 2) {
            return RepeatStatus.CONTINUABLE;
View Full Code Here

      public void open(RepeatContext context) {
        calls.add("2");
        context.setCompleteOnly();
      }
    } });
    template.iterate(new RepeatCallback() {
            @Override
      public RepeatStatus doInIteration(RepeatContext context) throws Exception {
        count++;
        return RepeatStatus.CONTINUABLE;
      }
View Full Code Here

    template.setExceptionHandler(exHandler);
    template.setListeners(new RepeatListener[] { listener });

    try {
      template.iterate(new RepeatCallback() {
                @Override
        public RepeatStatus doInIteration(RepeatContext context) throws Exception {
          throw new RepeatException("typically thrown by nested repeat template", exception);
        }
      });
View Full Code Here

            @Override
      public void open(RepeatContext context) {
        calls.add("1");
      }
    });
    template.iterate(new RepeatCallback() {
            @Override
      public RepeatStatus doInIteration(RepeatContext context) throws Exception {
        count++;
        context.setCompleteOnly();
        return RepeatStatus.FINISHED;
View Full Code Here

            @Override
      public void close(RepeatContext context) {
        calls.add("2");
      }
    } });
    template.iterate(new RepeatCallback() {
            @Override
      public RepeatStatus doInIteration(RepeatContext context) throws Exception {
        count++;
        return RepeatStatus.continueIf(count < 2);
      }
View Full Code Here

TOP

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

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.