Class AbstractTaskletStepBuilder<B extends AbstractTaskletStepBuilder<B>>

  • Type Parameters:
    B - the type of builder represented
    Direct Known Subclasses:
    SimpleStepBuilder, TaskletStepBuilder

    public abstract class AbstractTaskletStepBuilder<B extends AbstractTaskletStepBuilder<B>>
    extends StepBuilderHelper<AbstractTaskletStepBuilder<B>>
    Base class for step builders that want to build a TaskletStep. Handles common concerns across all tasklet step variants, which are mostly to do with the type of tasklet they carry.
    Since:
    2.2
    Author:
    Dave Syer, Michael Minella, Mahmoud Ben Hassine
    • Field Detail

      • chunkListeners

        protected java.util.Set<ChunkListener> chunkListeners
    • Constructor Detail

      • AbstractTaskletStepBuilder

        public AbstractTaskletStepBuilder​(StepBuilderHelper<?> parent)
    • Method Detail

      • createTasklet

        protected abstract Tasklet createTasklet()
      • registerStepListenerAsChunkListener

        protected void registerStepListenerAsChunkListener()
      • stream

        public AbstractTaskletStepBuilder<B> stream​(ItemStream stream)
        Register a stream for callbacks that manage restart data.
        Parameters:
        stream - the stream to register
        Returns:
        this for fluent chaining
      • taskExecutor

        public AbstractTaskletStepBuilder<B> taskExecutor​(org.springframework.core.task.TaskExecutor taskExecutor)
        Provide a task executor to use when executing the tasklet. Default is to use a single-threaded (synchronous) executor.
        Parameters:
        taskExecutor - the task executor to register
        Returns:
        this for fluent chaining
      • throttleLimit

        public AbstractTaskletStepBuilder<B> throttleLimit​(int throttleLimit)
        In the case of an asynchronous taskExecutor(TaskExecutor) the number of concurrent tasklet executions can be throttled (beyond any throttling provided by a thread pool). The throttle limit should be less than the data source pool size used in the job repository for this step.
        Parameters:
        throttleLimit - maximum number of concurrent tasklet executions allowed
        Returns:
        this for fluent chaining
      • exceptionHandler

        public AbstractTaskletStepBuilder<B> exceptionHandler​(ExceptionHandler exceptionHandler)
        Sets the exception handler to use in the case of tasklet failures. Default is to rethrow everything.
        Parameters:
        exceptionHandler - the exception handler
        Returns:
        this for fluent chaining
      • stepOperations

        public AbstractTaskletStepBuilder<B> stepOperations​(RepeatOperations repeatTemplate)
        Sets the repeat template used for iterating the tasklet execution. By default it will terminate only when the tasklet returns FINISHED (or null).
        Parameters:
        repeatTemplate - a repeat template with rules for iterating
        Returns:
        this for fluent chaining
      • transactionAttribute

        public AbstractTaskletStepBuilder<B> transactionAttribute​(org.springframework.transaction.interceptor.TransactionAttribute transactionAttribute)
        Sets the transaction attributes for the tasklet execution. Defaults to the default values for the transaction manager, but can be manipulated to provide longer timeouts for instance.
        Parameters:
        transactionAttribute - a transaction attribute set
        Returns:
        this for fluent chaining
      • getStepOperations

        protected RepeatOperations getStepOperations()
        Convenience method for subclasses to access the step operations that were injected by user.
        Returns:
        the repeat operations used to iterate the tasklet executions
      • getExceptionHandler

        protected ExceptionHandler getExceptionHandler()
        Convenience method for subclasses to access the exception handler that was injected by user.
        Returns:
        the exception handler
      • concurrent

        protected boolean concurrent()
        Convenience method for subclasses to determine if the step is concurrent.
        Returns:
        true if the tasklet is going to be run in multiple threads
      • getTaskExecutor

        protected org.springframework.core.task.TaskExecutor getTaskExecutor()
      • getThrottleLimit

        protected int getThrottleLimit()
      • getTransactionAttribute

        protected org.springframework.transaction.interceptor.TransactionAttribute getTransactionAttribute()
      • getStreams

        protected java.util.Set<ItemStream> getStreams()