Package org.springframework.batch.repeat

Examples of org.springframework.batch.repeat.RepeatCallback


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

    final RepeatCallback callback = new RepeatCallback() {
            @Override
      public RepeatStatus doInIteration(RepeatContext context) throws Exception {
        assertNotSame(threadName, Thread.currentThread().getName());
        Trade item = provider.read();
        threadNames.add(Thread.currentThread().getName() + " : " + item);
View Full Code Here


    jobTemplate.setTaskExecutor(taskExecutor);

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

    final RepeatCallback stepCallback = new ItemReaderRepeatCallback<Trade>(provider, processor) {
            @Override
      public RepeatStatus doInIteration(RepeatContext context) throws Exception {
        assertNotSame(threadName, Thread.currentThread().getName());
        threadNames.add(Thread.currentThread().getName());
        Thread.sleep(100);
        TradeItemReader provider = new TradeItemReader(resource);
        provider.open(new ExecutionContext());
        while (provider.read() != null)
          ;
        return super.doInIteration(context);
      }
    };
    RepeatCallback jobCallback = new RepeatCallback() {
            @Override
      public RepeatStatus doInIteration(RepeatContext context) throws Exception {
        stepTemplate.iterate(stepCallback);
        return RepeatStatus.FINISHED;
      }
View Full Code Here

public class NestedRepeatCallbackTests extends TestCase {

  int count = 0;

  public void testExecute() throws Exception {
    NestedRepeatCallback callback = new NestedRepeatCallback(new RepeatTemplate(), new RepeatCallback() {
            @Override
      public RepeatStatus doInIteration(RepeatContext context) throws Exception {
        count++;
        return RepeatStatus.continueIf(count <= 1);
      }
View Full Code Here

    template.setTaskExecutor(taskExecutor);
    template.setThrottleLimit(throttleLimit);

    items = Collections.synchronizedList(new ArrayList<String>());

    callback = new RepeatCallback() {

      private volatile AtomicInteger count = new AtomicInteger(0);

      @Override
      public RepeatStatus doInIteration(RepeatContext context)
View Full Code Here

  }
 
  @Test
  public void testErrorThrownByCallback() throws Exception {

    callback = new RepeatCallback() {

      private volatile AtomicInteger count = new AtomicInteger(0);

      @Override
      public RepeatStatus doInIteration(RepeatContext context)
View Full Code Here

        new TransactionTemplate(transactionManager).execute(new TransactionCallback<Void>() {
          @Override
          public Void doInTransaction(TransactionStatus status) {
            try {

              repeatTemplate.iterate(new RepeatCallback() {

                @Override
                public RepeatStatus doInIteration(RepeatContext context) throws Exception {

                  final String item = provider.read();
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.