SCT-82 Exit Code needs to be null while task is running
TaskLifecycleListener will set a TaskExecution's exitCode to null upon taskStart in the repository. Only at the end of the execution will it store the exitCode. resolves spring-cloud/spring-cloud-task#82
This commit is contained in:
committed by
Michael Minella
parent
472df2a399
commit
3b252680e7
@@ -160,7 +160,7 @@ public class TaskLifecycleListener implements ApplicationListener<ApplicationEve
|
||||
}
|
||||
|
||||
this.taskExecution = new TaskExecution(this.taskRepository.getNextExecutionId(),
|
||||
0, this.taskNameResolver.getTaskName(), new Date(), null, null,
|
||||
null, this.taskNameResolver.getTaskName(), new Date(), null, null,
|
||||
args);
|
||||
|
||||
this.taskRepository.createTaskExecution(this.taskExecution);
|
||||
|
||||
@@ -37,7 +37,7 @@ public class TaskExecution {
|
||||
/**
|
||||
* The recorded exit code for the task.
|
||||
*/
|
||||
private int exitCode;
|
||||
private Integer exitCode;
|
||||
|
||||
/**
|
||||
* User defined name for the task.
|
||||
@@ -68,7 +68,7 @@ public class TaskExecution {
|
||||
parameters = new ArrayList<>();
|
||||
}
|
||||
|
||||
public TaskExecution(long executionId, int exitCode, String taskName,
|
||||
public TaskExecution(long executionId, Integer exitCode, String taskName,
|
||||
Date startTime, Date endTime,
|
||||
String exitMessage, List<String> parameters) {
|
||||
|
||||
@@ -87,11 +87,11 @@ public class TaskExecution {
|
||||
return executionId;
|
||||
}
|
||||
|
||||
public int getExitCode() {
|
||||
public Integer getExitCode() {
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
public void setExitCode(int exitCode) {
|
||||
public void setExitCode(Integer exitCode) {
|
||||
this.exitCode = exitCode;
|
||||
}
|
||||
|
||||
|
||||
@@ -324,7 +324,7 @@ public class JdbcTaskExecutionDao implements TaskExecutionDao {
|
||||
public TaskExecution mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
long id = rs.getLong("TASK_EXECUTION_ID");
|
||||
TaskExecution taskExecution=new TaskExecution(id,
|
||||
rs.getInt("EXIT_CODE"),
|
||||
(Integer) rs.getObject("EXIT_CODE"),
|
||||
rs.getString("TASK_NAME"),
|
||||
rs.getTimestamp("START_TIME"),
|
||||
rs.getTimestamp("END_TIME"),
|
||||
|
||||
Reference in New Issue
Block a user