Example usage for org.springframework.batch.core JobInstance toString

List of usage examples for org.springframework.batch.core JobInstance toString

Introduction

In this page you can find the example usage for org.springframework.batch.core JobInstance toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:org.trpr.platform.batch.impl.spring.admin.repository.MapJobInstanceDao.java

public JobInstance createJobInstance(String jobName, JobParameters jobParameters) {

    Assert.state(getJobInstance(jobName, jobParameters) == null, "JobInstance must not already exist");

    JobInstance jobInstance = new JobInstance(currentId++, jobParameters, jobName);
    jobInstance.incrementVersion();//  ww w . j  av a2  s. c o  m
    //Removes the older jobInstances
    if (this.jobInstances.size() >= maxJobInstanceCount) {
        JobInstance toRemove = this.jobInstances.remove();
        LOGGER.info("Removing jobInstance: " + toRemove.toString());
        List<JobExecution> executions = this.jobExecutionDao.findJobExecutions(toRemove);
        for (JobExecution execution : executions) {
            //Remove job executions
            LOGGER.info("Removing JobExecution: " + execution.toString());
            this.jobExecutionDao.removeExecution(execution.getId());
            this.stepExecutionDao.removeStepExecutions(execution);
            //Remove execution contexts
            this.executionContextDao.removeExecutionContext(execution);
        }
    }
    jobInstances.add(jobInstance);
    return jobInstance;
}