Package org.springframework.batch.repeat

Examples of org.springframework.batch.repeat.RepeatCallback


      public void onError(RepeatContext context, Throwable t) {
        calls.add("2");
      }
    } });
    try {
      template.iterate(new RepeatCallback() {
                @Override
        public RepeatStatus doInIteration(RepeatContext context) throws Exception {
          throw new IllegalStateException("Bogus");
        }
      });
View Full Code Here


      public void onError(RepeatContext context, Throwable t) {
        calls.add("2");
      }
    } });
    try {
      template.iterate(new RepeatCallback() {
                @Override
        public RepeatStatus doInIteration(RepeatContext context) throws Exception {
          throw new IllegalStateException("Bogus");
        }
      });
View Full Code Here

        calls.add("2");
        fails.add("2");
      }
    } });
    try {
      template.iterate(new RepeatCallback() {
                @Override
        public RepeatStatus doInIteration(RepeatContext context) throws Exception {
          throw new IllegalStateException("Bogus");
        }
      });
View Full Code Here

   */
  @Test
  public void testChunkedBatchWithTerminationPolicy() throws Exception {

    RepeatTemplate repeatTemplate = new RepeatTemplate();
    final RepeatCallback callback = new ItemReaderRepeatCallback<Trade>(provider, processor);

    final RepeatTemplate chunkTemplate = new RepeatTemplate();
    // The policy is resettable so we only have to resolve this dependency
    // once
    chunkTemplate.setCompletionPolicy(new SimpleCompletionPolicy(2));
View Full Code Here

   */
  @Test
  public void testAsynchronousChunkedBatchWithCompletionPolicy() throws Exception {

    RepeatTemplate repeatTemplate = new RepeatTemplate();
    final RepeatCallback callback = new ItemReaderRepeatCallback<Trade>(provider, processor);

    final TaskExecutorRepeatTemplate chunkTemplate = new TaskExecutorRepeatTemplate();
    // The policy is resettable so we only have to resolve this dependency
    // once
    chunkTemplate.setCompletionPolicy(new SimpleCompletionPolicy(2));
View Full Code Here

      // convenience of checking that there is a result.
      result.setValue(new Object());
    }

    try {
      repeatOperations.iterate(new RepeatCallback() {

                @Override
        public RepeatStatus doInIteration(RepeatContext context) throws Exception {
          try {
View Full Code Here

    SimpleAsyncTaskExecutor taskExecutor = new SimpleAsyncTaskExecutor();
    template.setCompletionPolicy(new SimpleCompletionPolicy(20));
    taskExecutor.setConcurrencyLimit(2);
    template.setTaskExecutor(taskExecutor);
    try {
      template.iterate(new RepeatCallback() {
                @Override
        public RepeatStatus doInIteration(RepeatContext context) throws Exception {
          count++;
          throw new IllegalStateException("foo!");
        }
View Full Code Here

            @Override
      public void handleException(RepeatContext context, Throwable throwable) throws Throwable {
        count++;
      }
    });
    template.iterate(new RepeatCallback() {
            @Override
      public RepeatStatus doInIteration(RepeatContext context) throws Exception {
        throw new IllegalStateException("foo!");
      }
    });
View Full Code Here

  public void testNestedSession() throws Exception {

    RepeatTemplate outer = getRepeatTemplate();
    RepeatTemplate inner = new RepeatTemplate();

    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

  public void testMultiThreadAsynchronousExecution() throws Exception {

    final String threadName = Thread.currentThread().getName();
    final Set<String> threadNames = new HashSet<String>();

    final RepeatCallback callback = new RepeatCallback() {
            @Override
      public RepeatStatus doInIteration(RepeatContext context) throws Exception {
        assertNotSame(threadName, Thread.currentThread().getName());
        threadNames.add(Thread.currentThread().getName());
        Thread.sleep(100);
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.