类 StepParserStepFactoryBean<I,​O>

  • 所有已实现的接口:
    org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.FactoryBean<Step>
    直接已知子类:
    StepFactoryBean

    public class StepParserStepFactoryBean<I,​O>
    extends java.lang.Object
    implements org.springframework.beans.factory.FactoryBean<Step>, org.springframework.beans.factory.BeanNameAware
    This FactoryBean is used by the batch namespace parser to create Step objects. Stores all of the properties that are configurable on the <step/> (and its inner <tasklet/>). Based on which properties are configured, the getObject() method will delegate to the appropriate class for generating the Step.
    从以下版本开始:
    2.0
    作者:
    Dan Garrette, Josh Long, Michael Minella, Chris Schaefer
    另请参阅:
    SimpleStepFactoryBean, FaultTolerantStepFactoryBean, TaskletStep
    • 方法详细资料

      • setPartitionQueue

        public void setPartitionQueue​(java.util.Queue<java.io.Serializable> queue)
        参数:
        queue - The Queue that is used for communication between PartitionCollector and PartitionAnalyzer
      • setPartitionLock

        public void setPartitionLock​(java.util.concurrent.locks.ReentrantLock lock)
        Used to coordinate access to the partition queue between the PartitionCollector and AbstractPartitionAnalyzer
        参数:
        lock - a lock that will be locked around accessing the partition queue
      • getObject

        public Step getObject()
                       throws java.lang.Exception
        Create a Step from the configuration provided.
        指定者:
        getObject 在接口中 org.springframework.beans.factory.FactoryBean<I>
        抛出:
        java.lang.Exception
        另请参阅:
        FactoryBean.getObject()
      • validateFaultTolerantSettings

        protected void validateFaultTolerantSettings()
        Validates that all components required to build a fault tolerant step are set
      • isFaultTolerant

        protected boolean isFaultTolerant()
        返回:
        true if the step is configured with any components that require fault tolerance
      • getObjectType

        public java.lang.Class<TaskletStepgetObjectType()
        指定者:
        getObjectType 在接口中 org.springframework.beans.factory.FactoryBean<I>
      • isSingleton

        public boolean isSingleton()
        指定者:
        isSingleton 在接口中 org.springframework.beans.factory.FactoryBean<I>
      • setBeanName

        public void setBeanName​(java.lang.String name)
        Set the bean name property, which will become the name of the Step when it is created.
        指定者:
        setBeanName 在接口中 org.springframework.beans.factory.BeanNameAware
        另请参阅:
        BeanNameAware.setBeanName(java.lang.String)
      • setName

        public void setName​(java.lang.String name)
        参数:
        name - the name to set
      • getName

        public java.lang.String getName()
      • setFlow

        public void setFlow​(Flow flow)
        参数:
        flow - the flow to set
      • setGridSize

        public void setGridSize​(int gridSize)
        参数:
        gridSize - the gridSize to set
      • setStep

        public void setStep​(Step step)
        参数:
        step - the step to set
      • setAllowStartIfComplete

        public void setAllowStartIfComplete​(boolean allowStartIfComplete)
        Public setter for the flag to indicate that the step should be replayed on a restart, even if successful the first time.
        参数:
        allowStartIfComplete - the shouldAllowStartIfComplete to set
      • setStartLimit

        public void setStartLimit​(int startLimit)
        The number of times that the step should be allowed to start
        参数:
        startLimit - int containing the number of times a step should be allowed to start.
      • getTransactionManager

        public org.springframework.transaction.PlatformTransactionManager getTransactionManager()
        返回:
        transactionManager instance of PlatformTransactionManager used by the step.
      • setTransactionManager

        public void setTransactionManager​(org.springframework.transaction.PlatformTransactionManager transactionManager)
        参数:
        transactionManager - the transaction manager to set
      • setListeners

        public void setListeners​(java.lang.Object[] listeners)
        The listeners to inject into the Step. Any instance of StepListener can be used, and will then receive callbacks at the appropriate stage in the step.
        参数:
        listeners - an array of listeners
      • setNoRollbackExceptionClasses

        public void setNoRollbackExceptionClasses​(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> noRollbackExceptionClasses)
        Exception classes that may not cause a rollback if encountered in the right place.
        参数:
        noRollbackExceptionClasses - the noRollbackExceptionClasses to set
      • setTransactionTimeout

        public void setTransactionTimeout​(int transactionTimeout)
        参数:
        transactionTimeout - the transactionTimeout to set
      • setIsolation

        public void setIsolation​(org.springframework.transaction.annotation.Isolation isolation)
        参数:
        isolation - the isolation to set
      • setPropagation

        public void setPropagation​(org.springframework.transaction.annotation.Propagation propagation)
        参数:
        propagation - the propagation to set
      • setBackOffPolicy

        public void setBackOffPolicy​(org.springframework.retry.backoff.BackOffPolicy backOffPolicy)
        A backoff policy to be applied to retry process.
        参数:
        backOffPolicy - the BackOffPolicy to set
      • setRetryPolicy

        public void setRetryPolicy​(org.springframework.retry.RetryPolicy retryPolicy)
        A retry policy to apply when exceptions occur. If this is specified then the retry limit and retryable exceptions will be ignored.
        参数:
        retryPolicy - the RetryPolicy to set
      • setRetryContextCache

        public void setRetryContextCache​(org.springframework.retry.policy.RetryContextCache retryContextCache)
        参数:
        retryContextCache - the RetryContextCache to set
      • setKeyGenerator

        public void setKeyGenerator​(KeyGenerator keyGenerator)
        A key generator that can be used to compare items with previously recorded items in a retry. Only used if the reader is a transactional queue.
        参数:
        keyGenerator - the KeyGenerator to set
      • setCacheCapacity

        public void setCacheCapacity​(int cacheCapacity)
        Public setter for the capacity of the cache in the retry policy. If more items than this fail without being skipped or recovered an exception will be thrown. This is to guard against inadvertent infinite loops generated by item identity problems.

        The default value should be high enough and more for most purposes. To breach the limit in a single-threaded step typically you have to have this many failures in a single transaction. Defaults to the value in the MapRetryContextCache.
        参数:
        cacheCapacity - the cache capacity to set (greater than 0 else ignored)
      • setChunkCompletionPolicy

        public void setChunkCompletionPolicy​(CompletionPolicy chunkCompletionPolicy)
        Public setter for the CompletionPolicy applying to the chunk level. A transaction will be committed when this policy decides to complete. Defaults to a SimpleCompletionPolicy with chunk size equal to the commitInterval property.
        参数:
        chunkCompletionPolicy - the chunkCompletionPolicy to set
      • setCommitInterval

        public void setCommitInterval​(int commitInterval)
        Set the commit interval. Either set this or the chunkCompletionPolicy but not both.
        参数:
        commitInterval - 1 by default
      • setIsReaderTransactionalQueue

        public void setIsReaderTransactionalQueue​(boolean isReaderTransactionalQueue)
        Flag to signal that the reader is transactional (usually a JMS consumer) so that items are re-presented after a rollback. The default is false and readers are assumed to be forward-only.
        参数:
        isReaderTransactionalQueue - the value of the flag
      • setProcessorTransactional

        public void setProcessorTransactional​(java.lang.Boolean processorTransactional)
        Flag to signal that the processor is transactional, in which case it should be called for every item in every transaction. If false then we can cache the processor results between transactions in the case of a rollback.
        参数:
        processorTransactional - the value to set
      • setRetryLimit

        public void setRetryLimit​(int retryLimit)
        Public setter for the retry limit. Each item can be retried up to this limit. Note this limit includes the initial attempt to process the item, therefore retryLimit == 1 by default.
        参数:
        retryLimit - the retry limit to set, must be greater or equal to 1.
      • setSkipLimit

        public void setSkipLimit​(int skipLimit)
        Public setter for a limit that determines skip policy. If this value is positive then an exception in chunk processing will cause the item to be skipped and no exception propagated until the limit is reached. If it is zero then all exceptions will be propagated from the chunk and cause the step to abort.
        参数:
        skipLimit - the value to set. Default is 0 (never skip).
      • setSkipPolicy

        public void setSkipPolicy​(SkipPolicy skipPolicy)
        Public setter for a skip policy. If this value is set then the skip limit and skippable exceptions are ignored.
        参数:
        skipPolicy - the SkipPolicy to set
      • setTaskExecutor

        public void setTaskExecutor​(org.springframework.core.task.TaskExecutor taskExecutor)
        Public setter for the TaskExecutor. If this is set, then it will be used to execute the chunk processing inside the Step.
        参数:
        taskExecutor - the taskExecutor to set
      • setThrottleLimit

        public void setThrottleLimit​(java.lang.Integer throttleLimit)
        Public setter for the throttle limit. This limits the number of tasks queued for concurrent processing to prevent thread pools from being overwhelmed. Defaults to TaskExecutorRepeatTemplate.DEFAULT_THROTTLE_LIMIT.
        参数:
        throttleLimit - the throttle limit to set.
      • setRetryListeners

        public void setRetryListeners​(org.springframework.retry.RetryListener... retryListeners)
        Public setter for the RetryListeners.
        参数:
        retryListeners - the RetryListeners to set
      • setSkippableExceptionClasses

        public void setSkippableExceptionClasses​(java.util.Map<java.lang.Class<? extends java.lang.Throwable>,​java.lang.Boolean> exceptionClasses)
        Public setter for exception classes that when raised won't crash the job but will result in transaction rollback and the item which handling caused the exception will be skipped.
        参数:
        exceptionClasses - Map containing the Throwables as the keys and the values are Booleans, that if true the item is skipped.
      • setRetryableExceptionClasses

        public void setRetryableExceptionClasses​(java.util.Map<java.lang.Class<? extends java.lang.Throwable>,​java.lang.Boolean> retryableExceptionClasses)
        Public setter for exception classes that will retry the item when raised.
        参数:
        retryableExceptionClasses - the retryableExceptionClasses to set
      • setStreams

        public void setStreams​(ItemStream[] streams)
        The streams to inject into the Step. Any instance of ItemStream can be used, and will then receive callbacks at the appropriate stage in the step.
        参数:
        streams - an array of listeners
      • setHasChunkElement

        public void setHasChunkElement​(boolean hasChunkElement)
        参数:
        hasChunkElement - true if step has <chunk/> element.
      • hasChunkElement

        protected boolean hasChunkElement()
        返回:
        true if the defined step has a <chunk/> element
      • hasTasklet

        protected boolean hasTasklet()
        返回:
        true if the defined step has a <tasklet/> element
      • hasPartitionElement

        protected boolean hasPartitionElement()
        返回:
        true if the defined step has a <partition/> element