Example usage for org.springframework.batch.core.step.tasklet SystemCommandTasklet SystemCommandTasklet

List of usage examples for org.springframework.batch.core.step.tasklet SystemCommandTasklet SystemCommandTasklet

Introduction

In this page you can find the example usage for org.springframework.batch.core.step.tasklet SystemCommandTasklet SystemCommandTasklet.

Prototype

SystemCommandTasklet

Source Link

Usage

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

private void initializeTasklet() {
    tasklet = new SystemCommandTasklet();
    tasklet.setEnvironmentParams(null); // inherit from parent process
    tasklet.setWorkingDirectory(null); // inherit from parent process
    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);/*from ww  w  .  j  av a2 s.co  m*/
    tasklet.setTaskExecutor(new SimpleAsyncTaskExecutor());
}