public class JdbcTaskExecutionDao extends Object implements TaskExecutionDao
| Modifier and Type | Field and Description |
|---|---|
static String |
FROM_CLAUSE
FROM clause for task execution.
|
static String |
RUNNING_TASK_WHERE_CLAUSE
WHERE clause for running task.
|
static String |
SELECT_CLAUSE
SELECT clause for task execution.
|
static String |
TASK_NAME_WHERE_CLAUSE
WHERE clause for task name.
|
| Constructor and Description |
|---|
JdbcTaskExecutionDao(DataSource dataSource)
Initializes the JdbTaskExecutionDao and defaults the table prefix to
TaskProperties.DEFAULT_TABLE_PREFIX. |
JdbcTaskExecutionDao(DataSource dataSource,
String tablePrefix)
Initializes the JdbcTaskExecutionDao.
|
| Modifier and Type | Method and Description |
|---|---|
void |
completeTaskExecution(long taskExecutionId,
Integer exitCode,
Date endTime,
String exitMessage)
Update and existing
TaskExecution. |
void |
completeTaskExecution(long taskExecutionId,
Integer exitCode,
Date endTime,
String exitMessage,
String errorMessage)
Update and existing
TaskExecution to mark it as completed. |
TaskExecution |
createTaskExecution(String taskName,
Date startTime,
List<String> arguments,
String externalExecutionId)
Save a new
TaskExecution. |
TaskExecution |
createTaskExecution(String taskName,
Date startTime,
List<String> arguments,
String externalExecutionId,
Long parentExecutionId)
Save a new
TaskExecution. |
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.
|
Set<Long> |
getJobExecutionIdsByTaskExecutionId(long taskExecutionId)
Returns the job execution ids associated with a task execution id.
|
TaskExecution |
getLatestTaskExecutionForTaskName(String taskName)
Returns the latest task execution for a given task name.
|
List<TaskExecution> |
getLatestTaskExecutionsByTaskNames(String... taskNames)
Returns a
List of the latest TaskExecution for 1 or more task
names. |
long |
getNextExecutionId()
Retrieves the next available execution id for a task execution.
|
long |
getRunningTaskExecutionCount()
Retrieves current number of task executions with an endTime of null.
|
long |
getRunningTaskExecutionCountByTaskName(String taskName)
Retrieves current number of task executions for a taskName and with an endTime of
null.
|
TaskExecution |
getTaskExecution(long executionId)
Retrieves a task execution from the task repository.
|
long |
getTaskExecutionCount()
Retrieves current number of task executions.
|
long |
getTaskExecutionCountByTaskName(String taskName)
Retrieves current number of task executions for a taskName.
|
Long |
getTaskExecutionIdByJobExecutionId(long jobExecutionId)
Returns the id of the TaskExecution that the requested Spring Batch job execution
was executed within the context of.
|
List<String> |
getTaskNames()
Retrieves a sorted list of distinct task names for the task executions.
|
void |
setTaskIncrementer(org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer taskIncrementer) |
TaskExecution |
startTaskExecution(long executionId,
String taskName,
Date startTime,
List<String> arguments,
String externalExecutionId)
Update and existing
TaskExecution to mark it as started. |
TaskExecution |
startTaskExecution(long executionId,
String taskName,
Date startTime,
List<String> arguments,
String externalExecutionId,
Long parentExecutionId)
Update and existing
TaskExecution to mark it as started. |
void |
updateExternalExecutionId(long taskExecutionId,
String externalExecutionId)
Updates the externalExecutionId for the execution id specified.
|
public static final String SELECT_CLAUSE
public static final String FROM_CLAUSE
public static final String RUNNING_TASK_WHERE_CLAUSE
public static final String TASK_NAME_WHERE_CLAUSE
public JdbcTaskExecutionDao(DataSource dataSource, String tablePrefix)
dataSource - used by the dao to execute queries and update the tables.tablePrefix - the table prefix to use for this dao.public JdbcTaskExecutionDao(DataSource dataSource)
TaskProperties.DEFAULT_TABLE_PREFIX.dataSource - used by the dao to execute queries and update the tables.public TaskExecution createTaskExecution(String taskName, Date startTime, List<String> arguments, String externalExecutionId)
TaskExecutionDaoTaskExecution.createTaskExecution in interface TaskExecutionDaotaskName - 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 platformTaskExecution instance.public TaskExecution createTaskExecution(String taskName, Date startTime, List<String> arguments, String externalExecutionId, Long parentExecutionId)
TaskExecutionDaoTaskExecution.createTaskExecution in interface TaskExecutionDaotaskName - 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.TaskExecution instance.public TaskExecution startTaskExecution(long executionId, String taskName, Date startTime, List<String> arguments, String externalExecutionId)
TaskExecutionDaoTaskExecution to mark it as started.startTaskExecution in interface TaskExecutionDaoexecutionId - 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 platformpublic TaskExecution startTaskExecution(long executionId, String taskName, Date startTime, List<String> arguments, String externalExecutionId, Long parentExecutionId)
TaskExecutionDaoTaskExecution to mark it as started.startTaskExecution in interface TaskExecutionDaoexecutionId - 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.public void completeTaskExecution(long taskExecutionId,
Integer exitCode,
Date endTime,
String exitMessage,
String errorMessage)
TaskExecutionDaoTaskExecution to mark it as completed.completeTaskExecution in interface TaskExecutionDaotaskExecutionId - 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.public void completeTaskExecution(long taskExecutionId,
Integer exitCode,
Date endTime,
String exitMessage)
TaskExecutionDaoTaskExecution.completeTaskExecution in interface TaskExecutionDaotaskExecutionId - 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.public TaskExecution getTaskExecution(long executionId)
TaskExecutionDaogetTaskExecution in interface TaskExecutionDaoexecutionId - the id associated with the task execution.public long getTaskExecutionCountByTaskName(String taskName)
TaskExecutionDaogetTaskExecutionCountByTaskName in interface TaskExecutionDaotaskName - the name of the task to search for in the repository.public long getRunningTaskExecutionCountByTaskName(String taskName)
TaskExecutionDaogetRunningTaskExecutionCountByTaskName in interface TaskExecutionDaotaskName - the name of the task to search for in the repository.public long getRunningTaskExecutionCount()
TaskExecutionDaogetRunningTaskExecutionCount in interface TaskExecutionDaopublic List<TaskExecution> getLatestTaskExecutionsByTaskNames(String... taskNames)
TaskExecutionDaoList of the latest TaskExecution for 1 or more task
names.
Latest is defined by the most recent start time. A TaskExecution does not
have to be finished (The results may including pending TaskExecutions).
It is theoretically possible that a TaskExecution with the same name to
have more than 1 TaskExecution for the exact same start time. In that case
the TaskExecution with the highest Task Execution ID is returned.
This method will not consider end times in its calculations. Thus, when a task
execution A starts after task execution B but finishes BEFORE task
execution A, then task execution B is being returned.getLatestTaskExecutionsByTaskNames in interface TaskExecutionDaotaskNames - At least 1 task name must be providedpublic TaskExecution getLatestTaskExecutionForTaskName(String taskName)
TaskExecutionDaoTaskExecutionDao.getLatestTaskExecutionsByTaskNames(String...)
but will only return a single result.getLatestTaskExecutionForTaskName in interface TaskExecutionDaotaskName - Must not be null or emptyTaskExecutionDao.getLatestTaskExecutionsByTaskNames(String...)public long getTaskExecutionCount()
TaskExecutionDaogetTaskExecutionCount in interface TaskExecutionDaopublic org.springframework.data.domain.Page<TaskExecution> findRunningTaskExecutions(String taskName, org.springframework.data.domain.Pageable pageable)
TaskExecutionDaofindRunningTaskExecutions in interface TaskExecutionDaotaskName - the name of the task to search for in the repository.pageable - the constraints for the search.public org.springframework.data.domain.Page<TaskExecution> findTaskExecutionsByName(String taskName, org.springframework.data.domain.Pageable pageable)
TaskExecutionDaofindTaskExecutionsByName in interface TaskExecutionDaotaskName - the name of the task to search for in the repository.pageable - the constraints for the search.public List<String> getTaskNames()
TaskExecutionDaogetTaskNames in interface TaskExecutionDaopublic org.springframework.data.domain.Page<TaskExecution> findAll(org.springframework.data.domain.Pageable pageable)
TaskExecutionDaofindAll in interface TaskExecutionDaopageable - the constraints for the searchpublic void setTaskIncrementer(org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer taskIncrementer)
public long getNextExecutionId()
TaskExecutionDaogetNextExecutionId in interface TaskExecutionDaopublic Long getTaskExecutionIdByJobExecutionId(long jobExecutionId)
TaskExecutionDaogetTaskExecutionIdByJobExecutionId in interface TaskExecutionDaojobExecutionId - the id of the JobExecutionTaskExecutionpublic Set<Long> getJobExecutionIdsByTaskExecutionId(long taskExecutionId)
TaskExecutionDaogetJobExecutionIdsByTaskExecutionId in interface TaskExecutionDaotaskExecutionId - id of the TaskExecutionSet of the ids of the job executions executed within the
task.public void updateExternalExecutionId(long taskExecutionId,
String externalExecutionId)
TaskExecutionDaoupdateExternalExecutionId in interface TaskExecutionDaotaskExecutionId - the execution id for the task to be updated.externalExecutionId - the new externalExecutionId.Copyright © 2019 Pivotal Software, Inc.. All rights reserved.