Class SimpleTaskExplorer
java.lang.Object
org.springframework.cloud.task.repository.support.SimpleTaskExplorer
- All Implemented Interfaces:
TaskExplorer
TaskExplorer for that gathers task information from a task repository.
- Author:
- Glenn Renfro, Michael Minella, Gunnar Hillert, David Turanski
-
Constructor Summary
Constructors -
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 aListof the latestTaskExecutionfor 1 or more task names.longRetrieves current number of running task executions.getTaskExecution(long executionId) Retrieve aTaskExecutionby its id.longRetrieves current number of task executions.longgetTaskExecutionCountByTaskName(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.
-
Constructor Details
-
SimpleTaskExplorer
-
-
Method Details
-
getTaskExecution
Description copied from interface:TaskExplorerRetrieve aTaskExecutionby its id.- Specified by:
getTaskExecutionin interfaceTaskExplorer- Parameters:
executionId- the task execution id- Returns:
- the
TaskExecutionwith this id, or null if not found
-
findRunningTaskExecutions
public org.springframework.data.domain.Page<TaskExecution> findRunningTaskExecutions(String taskName, org.springframework.data.domain.Pageable pageable) Description copied from interface:TaskExplorerRetrieve a collection of taskExecutions that have the task name provided.- Specified by:
findRunningTaskExecutionsin interfaceTaskExplorer- 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
Description copied from interface:TaskExplorerRetrieve a list of available task names.- Specified by:
getTaskNamesin interfaceTaskExplorer- Returns:
- the set of task names that have been executed
-
getTaskExecutionCountByTaskName
Description copied from interface:TaskExplorerGet number of executions for a taskName.- Specified by:
getTaskExecutionCountByTaskNamein interfaceTaskExplorer- Parameters:
taskName- the name of the task to be searched- Returns:
- the number of running tasks that have the taskname specified
-
getTaskExecutionCount
public long getTaskExecutionCount()Description copied from interface:TaskExplorerRetrieves current number of task executions.- Specified by:
getTaskExecutionCountin interfaceTaskExplorer- Returns:
- current number of task executions.
-
getRunningTaskExecutionCount
public long getRunningTaskExecutionCount()Description copied from interface:TaskExplorerRetrieves current number of running task executions.- Specified by:
getRunningTaskExecutionCountin interfaceTaskExplorer- Returns:
- current number 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:TaskExplorerGet a collection/page of executions.- Specified by:
findTaskExecutionsByNamein interfaceTaskExplorer- Parameters:
taskName- the name of the task to be searchedpageable- the constraints for the search- Returns:
- list of task executions
-
findAll
public org.springframework.data.domain.Page<TaskExecution> findAll(org.springframework.data.domain.Pageable pageable) Description copied from interface:TaskExplorerRetrieves all the task executions within the pageable constraints sorted by start date descending, taskExecution id descending.- Specified by:
findAllin interfaceTaskExplorer- Parameters:
pageable- the constraints for the search- Returns:
- page containing the results from the search
-
getTaskExecutionIdByJobExecutionId
Description copied from interface:TaskExplorerReturns the id of the TaskExecution that the requested Spring Batch job execution was executed within the context of. Returns null if none were found.- Specified by:
getTaskExecutionIdByJobExecutionIdin interfaceTaskExplorer- Parameters:
jobExecutionId- the id of the JobExecution- Returns:
- the id of the
TaskExecution
-
getJobExecutionIdsByTaskExecutionId
Description copied from interface:TaskExplorerReturns a Set of JobExecution ids for the jobs that were executed within the scope of the requested task.- Specified by:
getJobExecutionIdsByTaskExecutionIdin interfaceTaskExplorer- Parameters:
taskExecutionId- id of theTaskExecution- Returns:
- a
Setof the ids of the job executions executed within the task.
-
getLatestTaskExecutionsByTaskNames
Description copied from interface:TaskExplorerReturns 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 interfaceTaskExplorer- 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:TaskExplorerReturns the latest task execution for a given task name. Will ultimately apply the same algorithm underneath asTaskExplorer.getLatestTaskExecutionsByTaskNames(String...)but will only return a single result.- Specified by:
getLatestTaskExecutionForTaskNamein interfaceTaskExplorer- Parameters:
taskName- Must not be null or empty- Returns:
- The latest Task Execution or null
- See Also:
-