类 SimpleStepFactoryBean<T,S>
- java.lang.Object
- org.springframework.batch.core.step.factory.SimpleStepFactoryBean<T,S>
- 所有已实现的接口:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.FactoryBean<Step>
- 直接已知子类:
FaultTolerantStepFactoryBean
public class SimpleStepFactoryBean<T,S> extends java.lang.Object implements org.springframework.beans.factory.FactoryBean<Step>, org.springframework.beans.factory.BeanNameAware
Most common configuration options for simple steps should be found here. Use this factory bean instead of creating aStep
implementation manually. This factory does not support configuration of fault-tolerant behavior, use appropriate subclass of this factory bean to configure skip or retry.- 作者:
- Dave Syer, Robert Kasanicky
- 另请参阅:
FaultTolerantStepFactoryBean
字段概要
字段 修饰符和类型 字段 说明 protected org.apache.commons.logging.Log
logger
构造器概要
构造器 构造器 说明 SimpleStepFactoryBean()
Default constructor forSimpleStepFactoryBean
.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected void
applyConfiguration(SimpleStepBuilder<T,S> builder)
protected SimpleStepBuilder<T,S>
createBuilder(java.lang.String name)
protected RepeatOperations
getChunkOperations()
Protected getter for the chunk operations to make them available in subclasses.protected ExceptionHandler
getExceptionHandler()
Protected getter for theExceptionHandler
.protected ItemProcessor<? super T,? extends S>
getItemProcessor()
Protected getter for theItemProcessor
for subclasses to useprotected ItemReader<? extends T>
getItemReader()
Protected getter for theItemReader
for subclasses to use.protected ItemWriter<? super S>
getItemWriter()
Protected getter for theItemWriter
for subclasses to useprotected StepListener[]
getListeners()
Protected getter for theStepListener
s.java.lang.String
getName()
Public getter for the name of the step.Step
getObject()
Create aStep
from the configuration provided.java.lang.Class<TaskletStep>
getObjectType()
protected RepeatOperations
getStepOperations()
Protected getter for the step operations to make them available in subclasses.protected org.springframework.core.task.TaskExecutor
getTaskExecutor()
Make theTaskExecutor
available to subclassesprotected org.springframework.transaction.interceptor.TransactionAttribute
getTransactionAttribute()
Getter for theTransactionAttribute
for subclasses only.protected boolean
isReaderTransactionalQueue()
Convenience method for subclasses.boolean
isSingleton()
Returns true by default, but in most cases aStep
should not be treated as thread-safe.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.void
setBeanName(java.lang.String name)
Set the bean name property, which will become the name of theStep
when it is created.void
setChunkCompletionPolicy(CompletionPolicy chunkCompletionPolicy)
Public setter for theCompletionPolicy
applying to the chunk level.void
setChunkOperations(RepeatOperations chunkOperations)
Public setter for the chunkOperations.void
setCommitInterval(int commitInterval)
Set the commit interval.void
setExceptionHandler(ExceptionHandler exceptionHandler)
Public setter for theExceptionHandler
.void
setIsolation(org.springframework.transaction.annotation.Isolation isolation)
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.void
setItemProcessor(ItemProcessor<? super T,? extends S> itemProcessor)
void
setItemReader(ItemReader<? extends T> itemReader)
void
setItemWriter(ItemWriter<? super S> itemWriter)
void
setJobRepository(JobRepository jobRepository)
Public setter forJobRepository
.void
setListeners(StepListener[] listeners)
The listeners to inject into theStep
.void
setPropagation(org.springframework.transaction.annotation.Propagation propagation)
void
setSingleton(boolean singleton)
Public setter for the singleton flag.void
setStartLimit(int startLimit)
Public setter for the start limit for the step.void
setStepOperations(RepeatOperations stepOperations)
Public setter for the stepOperations.void
setStreams(ItemStream[] streams)
The streams to inject into theStep
.void
setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
Public setter for theTaskExecutor
.void
setThrottleLimit(int throttleLimit)
Public setter for the throttle limit.void
setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
Public setter for thePlatformTransactionManager
.void
setTransactionTimeout(int transactionTimeout)
The timeout for an individual transaction in the step.
字段详细资料
logger
protected final org.apache.commons.logging.Log logger
构造器详细资料
SimpleStepFactoryBean
public SimpleStepFactoryBean()
Default constructor forSimpleStepFactoryBean
.
方法详细资料
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
isReaderTransactionalQueue
protected boolean isReaderTransactionalQueue()
Convenience method for subclasses.- 返回:
- true if the flag is set (default false)
setBeanName
public void setBeanName(java.lang.String name)
Set the bean name property, which will become the name of theStep
when it is created.- 指定者:
setBeanName
在接口中org.springframework.beans.factory.BeanNameAware
- 另请参阅:
BeanNameAware.setBeanName(java.lang.String)
getName
public java.lang.String getName()
Public getter for the name of the step.- 返回:
- the name
setTransactionTimeout
public void setTransactionTimeout(int transactionTimeout)
The timeout for an individual transaction in the step.- 参数:
transactionTimeout
- the transaction timeout to set, defaults to infinite
setPropagation
public void setPropagation(org.springframework.transaction.annotation.Propagation propagation)
- 参数:
propagation
- the propagation to set for business transactions
setIsolation
public void setIsolation(org.springframework.transaction.annotation.Isolation isolation)
- 参数:
isolation
- the isolation to set for business transactions
setStartLimit
public void setStartLimit(int startLimit)
Public setter for the start limit for the step.- 参数:
startLimit
- the startLimit 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
setItemReader
public void setItemReader(ItemReader<? extends T> itemReader)
- 参数:
itemReader
- theItemReader
to set
setItemWriter
public void setItemWriter(ItemWriter<? super S> itemWriter)
- 参数:
itemWriter
- theItemWriter
to set
setItemProcessor
public void setItemProcessor(ItemProcessor<? super T,? extends S> itemProcessor)
- 参数:
itemProcessor
- theItemProcessor
to set
setStreams
public void setStreams(ItemStream[] streams)
The streams to inject into theStep
. Any instance ofItemStream
can be used, and will then receive callbacks at the appropriate stage in the step.- 参数:
streams
- an array of listeners
setListeners
public void setListeners(StepListener[] listeners)
The listeners to inject into theStep
. Any instance ofStepListener
can be used, and will then receive callbacks at the appropriate stage in the step.- 参数:
listeners
- an array of listeners
getListeners
protected StepListener[] getListeners()
Protected getter for theStepListener
s.- 返回:
- the listeners
getItemReader
protected ItemReader<? extends T> getItemReader()
Protected getter for theItemReader
for subclasses to use.- 返回:
- the itemReader
getItemWriter
protected ItemWriter<? super S> getItemWriter()
Protected getter for theItemWriter
for subclasses to use- 返回:
- the itemWriter
getItemProcessor
protected ItemProcessor<? super T,? extends S> getItemProcessor()
Protected getter for theItemProcessor
for subclasses to use- 返回:
- the itemProcessor
setJobRepository
public void setJobRepository(JobRepository jobRepository)
Public setter forJobRepository
.- 参数:
jobRepository
- is a mandatory dependence (no default).
setTransactionManager
public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
Public setter for thePlatformTransactionManager
.- 参数:
transactionManager
- the transaction manager to set
getTransactionAttribute
protected org.springframework.transaction.interceptor.TransactionAttribute getTransactionAttribute()
Getter for theTransactionAttribute
for subclasses only.- 返回:
- the transactionAttribute
getObject
public final Step getObject() throws java.lang.Exception
Create aStep
from the configuration provided.- 指定者:
getObject
在接口中org.springframework.beans.factory.FactoryBean<T>
- 抛出:
java.lang.Exception
- 另请参阅:
FactoryBean.getObject()
createBuilder
protected SimpleStepBuilder<T,S> createBuilder(java.lang.String name)
getObjectType
public java.lang.Class<TaskletStep> getObjectType()
- 指定者:
getObjectType
在接口中org.springframework.beans.factory.FactoryBean<T>
isSingleton
public boolean isSingleton()
Returns true by default, but in most cases aStep
should not be treated as thread-safe. Clients are recommended to create a new step for each job execution.- 指定者:
isSingleton
在接口中org.springframework.beans.factory.FactoryBean<T>
- 另请参阅:
FactoryBean.isSingleton()
setSingleton
public void setSingleton(boolean singleton)
Public setter for the singleton flag.- 参数:
singleton
- the value to set. Defaults to true.
setCommitInterval
public void setCommitInterval(int commitInterval)
Set the commit interval. Either set this or the chunkCompletionPolicy but not both.- 参数:
commitInterval
- 1 by default
setChunkCompletionPolicy
public void setChunkCompletionPolicy(CompletionPolicy chunkCompletionPolicy)
Public setter for theCompletionPolicy
applying to the chunk level. A transaction will be committed when this policy decides to complete. Defaults to aSimpleCompletionPolicy
with chunk size equal to the commitInterval property.- 参数:
chunkCompletionPolicy
- the chunkCompletionPolicy to set
getStepOperations
protected RepeatOperations getStepOperations()
Protected getter for the step operations to make them available in subclasses.- 返回:
- the step operations
setStepOperations
public void setStepOperations(RepeatOperations stepOperations)
Public setter for the stepOperations.- 参数:
stepOperations
- the stepOperations to set
setChunkOperations
public void setChunkOperations(RepeatOperations chunkOperations)
Public setter for the chunkOperations.- 参数:
chunkOperations
- the chunkOperations to set
getChunkOperations
protected RepeatOperations getChunkOperations()
Protected getter for the chunk operations to make them available in subclasses.- 返回:
- the step operations
setExceptionHandler
public void setExceptionHandler(ExceptionHandler exceptionHandler)
Public setter for theExceptionHandler
.- 参数:
exceptionHandler
- the exceptionHandler to set
getExceptionHandler
protected ExceptionHandler getExceptionHandler()
Protected getter for theExceptionHandler
.- 返回:
- the
ExceptionHandler
setTaskExecutor
public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
Public setter for theTaskExecutor
. If this is set, then it will be used to execute the chunk processing inside theStep
.- 参数:
taskExecutor
- the taskExecutor to set
getTaskExecutor
protected org.springframework.core.task.TaskExecutor getTaskExecutor()
Make theTaskExecutor
available to subclasses- 返回:
- the taskExecutor to be used to execute chunks
setThrottleLimit
public void setThrottleLimit(int 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 toTaskExecutorRepeatTemplate.DEFAULT_THROTTLE_LIMIT
.- 参数:
throttleLimit
- the throttle limit to set.
applyConfiguration
protected void applyConfiguration(SimpleStepBuilder<T,S> builder)