Example usage for org.springframework.batch.core ExitStatus isRunning

List of usage examples for org.springframework.batch.core ExitStatus isRunning

Introduction

In this page you can find the example usage for org.springframework.batch.core ExitStatus isRunning.

Prototype

public boolean isRunning() 

Source Link

Document

Check if this status represents a running process.

Usage

From source file:de.codecentric.batch.FlatFileJobIntegrationTest.java

protected ExitStatus runJobAndWaitForCompletion(String hostname, String port, String jobName,
        String jobParameters) throws InterruptedException {
    MultiValueMap<String, String> parameters = new LinkedMultiValueMap<String, String>();
    parameters.add("jobParameters", jobParameters);
    String jobExecutionId = restTemplate.postForObject(
            "http://" + hostname + ":" + port + "/batch/operations/jobs/" + jobName + "", parameters,
            String.class);
    ExitStatus exitStatus = getStatus(hostname, port, jobExecutionId);
    // Wait for end of job
    while (exitStatus.isRunning()) {
        Thread.sleep(100);//from   ww w .  jav  a  2s.co m
        exitStatus = getStatus(hostname, port, jobExecutionId);
    }
    return exitStatus;
}