Package org.springframework.core.task

Examples of org.springframework.core.task.SimpleAsyncTaskExecutor


    assertEquals("[2]", calls.toString());
  }

  public void testAsynchronousOnErrorInterceptorsPrecedence() throws Exception {
    TaskExecutorRepeatTemplate template = new TaskExecutorRepeatTemplate();
    template.setTaskExecutor(new SimpleAsyncTaskExecutor());
    final List<Object> calls = new ArrayList<Object>();
    final List<Object> fails = new ArrayList<Object>();
    template.setListeners(new RepeatListener[] { new RepeatListenerSupport() {
            @Override
      public void after(RepeatContext context, RepeatStatus result) {
View Full Code Here


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

    RepeatStatus result = repeatTemplate.iterate(new NestedRepeatCallback(chunkTemplate, callback) {

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

    assertEquals("[foo0, foo1]", stepExecutions.toString());
  }

  @Test
  public void testSetTaskExecutor() throws Exception {
    handler.setTaskExecutor(new SimpleAsyncTaskExecutor());
    handler.handle(stepExecutionSplitter, stepExecution);
    assertEquals(1, count);
  }
View Full Code Here

    tasklet.setSystemProcessExitCodeMapper(new TestExitCodeMapper());
    tasklet.setTimeout(5000); // long enough timeout
    tasklet.setTerminationCheckInterval(500);
    tasklet.setCommand("invalid command, change value for successful execution");
    tasklet.setInterruptOnCancel(true);
    tasklet.setTaskExecutor(new SimpleAsyncTaskExecutor());
    tasklet.afterPropertiesSet();

    tasklet.beforeStep(stepExecution);
  }
View Full Code Here

  }

  @Override
  public void afterPropertiesSet() throws Exception {
    if (this.taskExecutor == null) {
      this.taskExecutor = new SimpleAsyncTaskExecutor();
    }
  }
View Full Code Here

    jobRepository = new JobRepositorySupport();
    step.setJobRepository(jobRepository);

    TaskExecutorRepeatTemplate template = new TaskExecutorRepeatTemplate();
    template.setThrottleLimit(throttleLimit);
    SimpleAsyncTaskExecutor taskExecutor = new SimpleAsyncTaskExecutor();
    taskExecutor.setConcurrencyLimit(concurrencyLimit);
    template.setTaskExecutor(taskExecutor);
    step.setStepOperations(template);

    step.registerStream(new ItemStreamSupport() {
      private int count = 0;
View Full Code Here

    job = new JobSupport("FOO");

    TaskExecutorRepeatTemplate repeatTemplate = new TaskExecutorRepeatTemplate();
    repeatTemplate.setThrottleLimit(2);
    repeatTemplate.setTaskExecutor(new SimpleAsyncTaskExecutor());
    step.setStepOperations(repeatTemplate);
    step.setTransactionManager(transactionManager);
  }
View Full Code Here

    baseContext.getAutowireCapableBeanFactory().autowireBeanProperties(this,
        AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, false);

    if(taskExecutor == null) {
      taskExecutor = new SimpleAsyncTaskExecutor();
    }
  }
View Full Code Here

  @Test
  public void testBuildSplit() throws Exception {
    Flow flow = new FlowBuilder<Flow>("subflow").from(step1).end();
    SimpleJobBuilder builder = new JobBuilder("flow").repository(jobRepository).start(step2);
    builder.split(new SimpleAsyncTaskExecutor()).add(flow).end();
    builder.preventRestart().build().execute(execution);
    assertEquals(BatchStatus.COMPLETED, execution.getStatus());
    assertEquals(2, execution.getStepExecutions().size());
  }
View Full Code Here

    Flow flow1 = mock(Flow.class);
    Flow flow2 = mock(Flow.class);

    SplitState state = new SplitState(Arrays.asList(flow1, flow2), "foo");
    state.setTaskExecutor(new SimpleAsyncTaskExecutor());

    when(flow1.start(executor)).thenReturn(new FlowExecution("step1", FlowExecutionStatus.COMPLETED));
    when(flow2.start(executor)).thenReturn(new FlowExecution("step1", FlowExecutionStatus.COMPLETED));
    FlowExecutionStatus result = state.handle(executor);
    assertEquals(FlowExecutionStatus.COMPLETED, result);
View Full Code Here

TOP

Related Classes of org.springframework.core.task.SimpleAsyncTaskExecutor

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.