Example usage for org.springframework.batch.core.job JobSupport JobSupport

List of usage examples for org.springframework.batch.core.job JobSupport JobSupport

Introduction

In this page you can find the example usage for org.springframework.batch.core.job JobSupport JobSupport.

Prototype

public JobSupport(String name) 

Source Link

Document

Convenience constructor to immediately add name (which is mandatory but not final).

Usage

From source file:org.springframework.batch.core.step.tasklet.AsyncChunkOrientedStepIntegrationTests.java

@Before
public void init() throws Exception {

    maxActive = dataSource.getMaxActive();
    maxIdle = dataSource.getMaxIdle();/*from w  w w . j a va2 s  .c  om*/

    // Force deadlock with batch waiting for DB pool and vice versa
    dataSource.setMaxActive(1);
    dataSource.setMaxIdle(1);

    step = new TaskletStep("stepName");
    step.setJobRepository(jobRepository);
    step.setTransactionManager(transactionManager);

    // Only process one item:
    chunkOperations = new RepeatTemplate();
    chunkOperations.setCompletionPolicy(new SimpleCompletionPolicy(1));

    job = new JobSupport("FOO");

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