Class MapTaskExecutionDao
java.lang.Object
org.springframework.cloud.task.repository.dao.MapTaskExecutionDao
- All Implemented Interfaces:
TaskExecutionDao
Stores Task Execution Information to a in-memory map.
- Author:
- Glenn Renfro, Gunnar Hillert, David Turanski
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcompleteTaskExecution(long executionId, Integer exitCode, LocalDateTime endTime, String exitMessage) Update and existingTaskExecution.voidcompleteTaskExecution(long executionId, Integer exitCode, LocalDateTime endTime, String exitMessage, String errorMessage) Update and existingTaskExecutionto mark it as completed.createTaskExecution(String taskName, LocalDateTime startTime, List<String> arguments, String externalExecutionId) Save a newTaskExecution.createTaskExecution(String taskName, LocalDateTime startTime, List<String> arguments, String externalExecutionId, Long parentExecutionId) Save a newTaskExecution.org.springframework.data.domain.Page<TaskExecution>findAll(org.springframework.data.domain.Pageable pageable) Retrieves all the task executions within the pageable constraints.org.springframework.data.domain.Page<TaskExecution>findRunningTaskExecutions(String taskName, org.springframework.data.domain.Pageable pageable) Retrieves a set of task executions that are running for a taskName.org.springframework.data.domain.Page<TaskExecution>findTaskExecutionsByName(String taskName, org.springframework.data.domain.Pageable pageable) Retrieves a subset of task executions by task name, start location and size.getJobExecutionIdsByTaskExecutionId(long taskExecutionId) Returns the job execution ids associated with a task execution id.getLatestTaskExecutionForTaskName(String taskName) Returns the latest task execution for a given task name.getLatestTaskExecutionsByTaskNames(String... taskNames) Returns aListof the latestTaskExecutionfor 1 or more task names.longRetrieves the next available execution id for a task execution.longRetrieves current number of task executions with an endTime of null.longgetRunningTaskExecutionCountByTaskName(String taskName) Retrieves current number of task executions for a taskName and with an endTime of null.getTaskExecution(long executionId) Retrieves a task execution from the task repository.longRetrieves current number of task executions.longgetTaskExecutionCountByTaskName(String taskName) Retrieves current number of task executions for a taskName.getTaskExecutionIdByJobExecutionId(long jobExecutionId) Returns the id of the TaskExecution that the requested Spring Batch job execution was executed within the context of.Retrieves a sorted list of distinct task names for the task executions.startTaskExecution(long executionId, String taskName, LocalDateTime startTime, List<String> arguments, String externalExecutionid) Update and existingTaskExecutionto mark it as started.startTaskExecution(long executionId, String taskName, LocalDateTime startTime, List<String> arguments, String externalExecutionid, Long parentExecutionId) Update and existingTaskExecutionto mark it as started.voidupdateExternalExecutionId(long taskExecutionId, String externalExecutionId) Updates the externalExecutionId for the execution id specified.
-
Constructor Details
-
MapTaskExecutionDao
public MapTaskExecutionDao()
-
-
Method Details
-
createTaskExecution
public TaskExecution createTaskExecution(String taskName, LocalDateTime startTime, List<String> arguments, String externalExecutionId) Description copied from interface:TaskExecutionDaoSave a newTaskExecution.- Specified by:
createTaskExecutionin interfaceTaskExecutionDao- Parameters:
taskName- the name that associated with the task execution.startTime- the time task began.arguments- list of key/value pairs that configure the task.externalExecutionId- id assigned to the task by the platform- Returns:
- A fully qualified
TaskExecutioninstance.
-
createTaskExecution
public TaskExecution createTaskExecution(String taskName, LocalDateTime startTime, List<String> arguments, String externalExecutionId, Long parentExecutionId) Description copied from interface:TaskExecutionDaoSave a newTaskExecution.- Specified by:
createTaskExecutionin interfaceTaskExecutionDao- Parameters:
taskName- the name that associated with the task execution.startTime- the time task began.arguments- list of key/value pairs that configure the task.externalExecutionId- id assigned to the task by the platformparentExecutionId- the parent task execution id.- Returns:
- A fully qualified
TaskExecutioninstance.
-
startTaskExecution
public TaskExecution startTaskExecution(long executionId, String taskName, LocalDateTime startTime, List<String> arguments, String externalExecutionid) Description copied from interface:TaskExecutionDaoUpdate and existingTaskExecutionto mark it as started.- Specified by:
startTaskExecutionin interfaceTaskExecutionDao- Parameters:
executionId- the id of the taskExecution to be updated.taskName- the name that associated with the task execution.startTime- the time task began.arguments- list of key/value pairs that configure the task.externalExecutionid- id assigned to the task by the platform- Returns:
- A TaskExecution containing the information available at task execution start.
-
startTaskExecution
public TaskExecution startTaskExecution(long executionId, String taskName, LocalDateTime startTime, List<String> arguments, String externalExecutionid, Long parentExecutionId) Description copied from interface:TaskExecutionDaoUpdate and existingTaskExecutionto mark it as started.- Specified by:
startTaskExecutionin interfaceTaskExecutionDao- Parameters:
executionId- the id of the taskExecution to be updated.taskName- the name that associated with the task execution.startTime- the time task began.arguments- list of key/value pairs that configure the task.externalExecutionid- id assigned to the task by the platformparentExecutionId- the parent task execution id.- Returns:
- A TaskExecution containing the information available at task execution start.
-
completeTaskExecution
public void completeTaskExecution(long executionId, Integer exitCode, LocalDateTime endTime, String exitMessage, String errorMessage) Description copied from interface:TaskExecutionDaoUpdate and existingTaskExecutionto mark it as completed.- Specified by:
completeTaskExecutionin interfaceTaskExecutionDao- Parameters:
executionId- the id of the taskExecution to be updated.exitCode- the status of the task upon completion.endTime- the time the task completed.exitMessage- the message assigned to the task upon completion.errorMessage- error information available upon failure of a task.
-
completeTaskExecution
public void completeTaskExecution(long executionId, Integer exitCode, LocalDateTime endTime, String exitMessage) Description copied from interface:TaskExecutionDaoUpdate and existingTaskExecution.- Specified by:
completeTaskExecutionin interfaceTaskExecutionDao- Parameters:
executionId- the id of the taskExecution to be updated.exitCode- the status of the task upon completion.endTime- the time the task completed.exitMessage- the message assigned to the task upon completion.
-
getTaskExecution
Description copied from interface:TaskExecutionDaoRetrieves a task execution from the task repository.- Specified by:
getTaskExecutionin interfaceTaskExecutionDao- Parameters:
executionId- the id associated with the task execution.- Returns:
- a fully qualified TaskExecution instance.
-
getTaskExecutionCountByTaskName
Description copied from interface:TaskExecutionDaoRetrieves current number of task executions for a taskName.- Specified by:
getTaskExecutionCountByTaskNamein interfaceTaskExecutionDao- Parameters:
taskName- the name of the task to search for in the repository.- Returns:
- current number of task executions for the taskName.
-
getRunningTaskExecutionCountByTaskName
Description copied from interface:TaskExecutionDaoRetrieves current number of task executions for a taskName and with an endTime of null.- Specified by:
getRunningTaskExecutionCountByTaskNamein interfaceTaskExecutionDao- Parameters:
taskName- the name of the task to search for in the repository.- Returns:
- current number of task executions for the taskName.
-
getRunningTaskExecutionCount
public long getRunningTaskExecutionCount()Description copied from interface:TaskExecutionDaoRetrieves current number of task executions with an endTime of null.- Specified by:
getRunningTaskExecutionCountin interfaceTaskExecutionDao- Returns:
- current number of task executions.
-
getTaskExecutionCount
public long getTaskExecutionCount()Description copied from interface:TaskExecutionDaoRetrieves current number of task executions.- Specified by:
getTaskExecutionCountin interfaceTaskExecutionDao- Returns:
- current number of task executions.
-
findRunningTaskExecutions
public org.springframework.data.domain.Page<TaskExecution> findRunningTaskExecutions(String taskName, org.springframework.data.domain.Pageable pageable) Description copied from interface:TaskExecutionDaoRetrieves a set of task executions that are running for a taskName.- Specified by:
findRunningTaskExecutionsin interfaceTaskExecutionDao- Parameters:
taskName- the name of the task to search for in the repository.pageable- the constraints for the search.- Returns:
- set of running task executions.
-
findTaskExecutionsByName
public org.springframework.data.domain.Page<TaskExecution> findTaskExecutionsByName(String taskName, org.springframework.data.domain.Pageable pageable) Description copied from interface:TaskExecutionDaoRetrieves a subset of task executions by task name, start location and size.- Specified by:
findTaskExecutionsByNamein interfaceTaskExecutionDao- Parameters:
taskName- the name of the task to search for in the repository.pageable- the constraints for the search.- Returns:
- a list that contains task executions from the query bound by the start position and count specified by the user.
-
getTaskNames
Description copied from interface:TaskExecutionDaoRetrieves a sorted list of distinct task names for the task executions.- Specified by:
getTaskNamesin interfaceTaskExecutionDao- Returns:
- a list of distinct task names from the task repository..
-
findAll
public org.springframework.data.domain.Page<TaskExecution> findAll(org.springframework.data.domain.Pageable pageable) Description copied from interface:TaskExecutionDaoRetrieves all the task executions within the pageable constraints.- Specified by:
findAllin interfaceTaskExecutionDao- Parameters:
pageable- the constraints for the search- Returns:
- page containing the results from the search
-
getTaskExecutions
-
getNextExecutionId
public long getNextExecutionId()Description copied from interface:TaskExecutionDaoRetrieves the next available execution id for a task execution.- Specified by:
getNextExecutionIdin interfaceTaskExecutionDao- Returns:
- long containing the executionId.
-
getTaskExecutionIdByJobExecutionId
Description copied from interface:TaskExecutionDaoReturns the id of the TaskExecution that the requested Spring Batch job execution was executed within the context of. Returns null if non were found.- Specified by:
getTaskExecutionIdByJobExecutionIdin interfaceTaskExecutionDao- Parameters:
jobExecutionId- the id of the JobExecution- Returns:
- the id of the
TaskExecution
-
getJobExecutionIdsByTaskExecutionId
Description copied from interface:TaskExecutionDaoReturns the job execution ids associated with a task execution id.- Specified by:
getJobExecutionIdsByTaskExecutionIdin interfaceTaskExecutionDao- Parameters:
taskExecutionId- id of theTaskExecution- Returns:
- a
Setof the ids of the job executions executed within the task.
-
updateExternalExecutionId
Description copied from interface:TaskExecutionDaoUpdates the externalExecutionId for the execution id specified.- Specified by:
updateExternalExecutionIdin interfaceTaskExecutionDao- Parameters:
taskExecutionId- the execution id for the task to be updated.externalExecutionId- the new externalExecutionId.
-
getBatchJobAssociations
-
getLatestTaskExecutionsByTaskNames
Description copied from interface:TaskExecutionDaoReturns aListof the latestTaskExecutionfor 1 or more task names. Latest is defined by the most recent start time. ATaskExecutiondoes not have to be finished (The results may including pendingTaskExecutions). It is theoretically possible that aTaskExecutionwith the same name to have more than 1TaskExecutionfor the exact same start time. In that case theTaskExecutionwith the highest Task Execution ID is returned. This method will not consider end times in its calculations. Thus, when a task executionAstarts after task executionBbut finishes BEFORE task executionA, then task executionBis being returned.- Specified by:
getLatestTaskExecutionsByTaskNamesin interfaceTaskExecutionDao- Parameters:
taskNames- At least 1 task name must be provided- Returns:
- List of TaskExecutions. May be empty but never null.
-
getLatestTaskExecutionForTaskName
Description copied from interface:TaskExecutionDaoReturns the latest task execution for a given task name. Will ultimately apply the same algorithm underneath asTaskExecutionDao.getLatestTaskExecutionsByTaskNames(String...)but will only return a single result.- Specified by:
getLatestTaskExecutionForTaskNamein interfaceTaskExecutionDao- Parameters:
taskName- Must not be null or empty- Returns:
- The latest Task Execution or null
- See Also:
-