Interface TaskExplorer
- All Known Implementing Classes:
SimpleTaskExplorer
public interface TaskExplorer
Offers methods that allow users to query the task executions that are available.
- Author:
- Glenn Renfro, Michael Minella, Gunnar Hillert
-
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.data.domain.Page<TaskExecution>
findAll
(org.springframework.data.domain.Pageable pageable) Retrieves all the task executions within the pageable constraints sorted by start date descending, taskExecution id descending.org.springframework.data.domain.Page<TaskExecution>
findRunningTaskExecutions
(String taskName, org.springframework.data.domain.Pageable pageable) Retrieve a collection of taskExecutions that have the task name provided.org.springframework.data.domain.Page<TaskExecution>
findTaskExecutionsByName
(String taskName, org.springframework.data.domain.Pageable pageable) Get a collection/page of executions.getJobExecutionIdsByTaskExecutionId
(long taskExecutionId) Returns a Set of JobExecution ids for the jobs that were executed within the scope of the requested task.getLatestTaskExecutionForTaskName
(String taskName) Returns the latest task execution for a given task name.getLatestTaskExecutionsByTaskNames
(String... taskNames) Returns aList
of the latestTaskExecution
for 1 or more task names.long
Retrieves current number of running task executions.getTaskExecution
(long executionId) Retrieve aTaskExecution
by its id.long
Retrieves current number of task executions.long
getTaskExecutionCountByTaskName
(String taskName) Get number of 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.Retrieve a list of available task names.
-
Method Details
-
getTaskExecution
Retrieve aTaskExecution
by its id.- Parameters:
executionId
- the task execution id- Returns:
- the
TaskExecution
with this id, or null if not found
-
findRunningTaskExecutions
org.springframework.data.domain.Page<TaskExecution> findRunningTaskExecutions(String taskName, org.springframework.data.domain.Pageable pageable) Retrieve a collection of taskExecutions that have the task name provided.- Parameters:
taskName
- the name of the taskpageable
- the constraints for the search- Returns:
- the set of running executions for tasks with the specified name
-
getTaskNames
Retrieve a list of available task names.- Returns:
- the set of task names that have been executed
-
getTaskExecutionCountByTaskName
Get number of executions for a taskName.- Parameters:
taskName
- the name of the task to be searched- Returns:
- the number of running tasks that have the taskname specified
-
getTaskExecutionCount
long getTaskExecutionCount()Retrieves current number of task executions.- Returns:
- current number of task executions.
-
getRunningTaskExecutionCount
long getRunningTaskExecutionCount()Retrieves current number of running task executions.- Returns:
- current number of running task executions.
-
findTaskExecutionsByName
org.springframework.data.domain.Page<TaskExecution> findTaskExecutionsByName(String taskName, org.springframework.data.domain.Pageable pageable) Get a collection/page of executions.- Parameters:
taskName
- the name of the task to be searchedpageable
- the constraints for the search- Returns:
- list of task executions
-
findAll
org.springframework.data.domain.Page<TaskExecution> findAll(org.springframework.data.domain.Pageable pageable) Retrieves all the task executions within the pageable constraints sorted by start date descending, taskExecution id descending.- Parameters:
pageable
- the constraints for the search- Returns:
- page containing the results from the search
-
getTaskExecutionIdByJobExecutionId
Returns the id of the TaskExecution that the requested Spring Batch job execution was executed within the context of. Returns null if none were found.- Parameters:
jobExecutionId
- the id of the JobExecution- Returns:
- the id of the
TaskExecution
-
getJobExecutionIdsByTaskExecutionId
Returns a Set of JobExecution ids for the jobs that were executed within the scope of the requested task.- Parameters:
taskExecutionId
- id of theTaskExecution
- Returns:
- a
Set
of the ids of the job executions executed within the task.
-
getLatestTaskExecutionsByTaskNames
Returns aList
of the latestTaskExecution
for 1 or more task names. Latest is defined by the most recent start time. ATaskExecution
does not have to be finished (The results may including pendingTaskExecution
s). It is theoretically possible that aTaskExecution
with the same name to have more than 1TaskExecution
for the exact same start time. In that case theTaskExecution
with the highest Task Execution ID is returned. This method will not consider end times in its calculations. Thus, when a task executionA
starts after task executionB
but finishes BEFORE task executionA
, then task executionB
is being returned.- Parameters:
taskNames
- At least 1 task name must be provided- Returns:
- List of TaskExecutions. May be empty but never null.
-
getLatestTaskExecutionForTaskName
Returns the latest task execution for a given task name. Will ultimately apply the same algorithm underneath asgetLatestTaskExecutionsByTaskNames(String...)
but will only return a single result.- Parameters:
taskName
- Must not be null or empty- Returns:
- The latest Task Execution or null
- See Also:
-