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

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

Introduction

In this page you can find the example usage for org.springframework.batch.core JobExecution getId.

Prototype

public Long getId() 

Source Link

Usage

From source file:org.springframework.cloud.task.batch.listener.TaskBatchExecutionListener.java

@Override
public void beforeJob(JobExecution jobExecution) {
    if (this.taskExecution == null) {
        logger.warn("This job was executed outside the scope of a task but still used the task listener.");
    } else {//w w  w .java  2 s . co m
        logger.info(String.format("The job execution id %s was run within the task execution %s",
                jobExecution.getId(), this.taskExecution.getExecutionId()));
        taskBatchDao.saveRelationship(taskExecution, jobExecution);
    }
}

From source file:org.springframework.yarn.batch.repository.JobRepositoryRemoteService.java

/**
 * Handles saving a job execution.//from  w  ww  . j av  a  2  s . co m
 *
 * @param request the {@link SaveJobExecutionReq}
 * @return the {@link SaveJobExecutionRes}
 */
private SaveJobExecutionRes handleSaveJobExecution(SaveJobExecutionReq request) {
    SaveJobExecutionRes response = null;
    try {
        JobExecution jobExecution = JobRepositoryRpcFactory.convertJobExecutionType(request.jobExecution);
        jobExecutionDao.saveJobExecution(jobExecution);
        response = new SaveJobExecutionRes();
        response.id = jobExecution.getId();
        response.version = jobExecution.getVersion();
    } catch (Exception e) {
        log.error("error handling command", e);
    }
    return response;
}

From source file:org.springframework.yarn.batch.repository.JobRepositoryService.java

private BaseResponseObject handleUpdateWithJobExecutionReq(UpdateWithJobExecutionReq request) {
    UpdateWithJobExecutionRes response = null;
    JobExecution jobExecution = JobRepositoryRpcFactory.convertJobExecutionType(request.jobExecution);
    jobRepository.update(jobExecution);//from ww  w  .  ja  va 2s .  c o m
    response = new UpdateWithJobExecutionRes();
    response.id = jobExecution.getId();
    response.version = jobExecution.getVersion();
    return response;
}