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

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

Introduction

In this page you can find the example usage for org.springframework.batch.core JobExecution 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();/*from   ww w.j  a  va 2s .  co  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;
}

From source file:org.springframework.batch.core.launch.support.SimpleJobOperator.java

@Override
public String getSummary(long executionId) throws NoSuchJobExecutionException {
    JobExecution jobExecution = findExecutionById(executionId);
    return jobExecution.toString();
}