Class TaskExecutorJobLauncher

java.lang.Object
org.springframework.batch.core.launch.support.TaskExecutorJobLauncher
All Implemented Interfaces:
JobLauncher, org.springframework.beans.factory.InitializingBean
Direct Known Subclasses:
SimpleJobOperator

@Deprecated(since="6.0", forRemoval=true) public class TaskExecutorJobLauncher extends Object implements JobLauncher, org.springframework.beans.factory.InitializingBean
Deprecated, for removal: This API element is subject to removal in a future version.
since 6.0 in favor of TaskExecutorJobOperator. Scheduled for removal in 6.2 or later.
Implementation of the JobLauncher interface based on a TaskExecutor. This means that the type of executor set is very important. If a SyncTaskExecutor is used, then the job will be processed within the same thread that called the launcher. Care should be taken to ensure any users of this class understand fully whether or not the implementation of TaskExecutor used will start tasks synchronously or asynchronously. The default setting uses a synchronous task executor.

There is only one required dependency of this Launcher, a JobRepository. The JobRepository is used to obtain a valid JobExecution. The Repository must be used because the provided Job could be a restart of an existing JobInstance, and only the Repository can reliably recreate it.

Since:
1.0
Author:
Lucas Ward, Dave Syer, Will Schipp, Michael Minella, Mahmoud Ben Hassine
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected io.micrometer.core.instrument.Counter
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected JobRepository
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected static final org.apache.commons.logging.Log
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected io.micrometer.core.instrument.MeterRegistry
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected org.springframework.core.task.TaskExecutor
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Ensure the required dependencies of a JobRepository have been set.
    run(Job job, JobParameters jobParameters)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Run the provided job with the given JobParameters.
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Set the JobRepository.
    void
    setMeterRegistry(io.micrometer.core.instrument.MeterRegistry meterRegistry)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Set the meter registry to use for metrics.
    void
    setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Set the TaskExecutor.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • logger

      protected static final org.apache.commons.logging.Log logger
      Deprecated, for removal: This API element is subject to removal in a future version.
    • jobRepository

      protected JobRepository jobRepository
      Deprecated, for removal: This API element is subject to removal in a future version.
    • taskExecutor

      protected org.springframework.core.task.TaskExecutor taskExecutor
      Deprecated, for removal: This API element is subject to removal in a future version.
    • meterRegistry

      protected io.micrometer.core.instrument.MeterRegistry meterRegistry
      Deprecated, for removal: This API element is subject to removal in a future version.
    • jobLaunchCount

      protected io.micrometer.core.instrument.Counter jobLaunchCount
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Constructor Details

    • TaskExecutorJobLauncher

      public TaskExecutorJobLauncher()
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • run

      Deprecated, for removal: This API element is subject to removal in a future version.
      Run the provided job with the given JobParameters. The JobParameters will be used to determine if this is an execution of an existing job instance, or if a new one should be created.
      Specified by:
      run in interface JobLauncher
      Parameters:
      job - the job to be run.
      jobParameters - the JobParameters for this particular execution.
      Returns:
      the JobExecution if it returns synchronously. If the implementation is asynchronous, the status might well be unknown.
      Throws:
      JobExecutionAlreadyRunningException - if the JobInstance already exists and has an execution already running.
      JobRestartException - if the execution would be a re-start, but a re-start is either not allowed or not needed.
      JobInstanceAlreadyCompleteException - if this instance has already completed successfully
      JobParametersInvalidException - thrown if jobParameters is invalid.
    • setJobRepository

      public void setJobRepository(JobRepository jobRepository)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the JobRepository.
      Parameters:
      jobRepository - instance of JobRepository.
    • setTaskExecutor

      public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the TaskExecutor. (Optional)
      Parameters:
      taskExecutor - instance of TaskExecutor.
    • setMeterRegistry

      public void setMeterRegistry(io.micrometer.core.instrument.MeterRegistry meterRegistry)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the meter registry to use for metrics. Defaults to Metrics.globalRegistry.
      Parameters:
      meterRegistry - the meter registry
      Since:
      5.0
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Deprecated, for removal: This API element is subject to removal in a future version.
      Ensure the required dependencies of a JobRepository have been set.
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception