类 JsrPartitionHandler
- java.lang.Object
- org.springframework.batch.core.jsr.partition.JsrPartitionHandler
- 所有已实现的接口:
PartitionHandler
,org.springframework.beans.factory.InitializingBean
public class JsrPartitionHandler extends java.lang.Object implements PartitionHandler, org.springframework.beans.factory.InitializingBean
Executes a step instance per thread using aThreadPoolTaskExecutor
in accordance with JSR-352. The results from each step is aggregated into a cumulative result.- 从以下版本开始:
- 3.0
- 作者:
- Michael Minella, Mahmoud Ben Hassine
嵌套类概要
嵌套类 修饰符和类型 类 说明 static class
JsrPartitionHandler.PartitionPlanState
Since aPartitionPlan
could provide dynamic data (different results from run to run), the batch runtime needs to save off the results for restarts.
构造器概要
构造器 构造器 说明 JsrPartitionHandler()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
protected java.util.concurrent.FutureTask<StepExecution>
createTask(Step step, StepExecution stepExecution)
Creates the task executing the given step in the context of the given execution.java.util.Collection<java.lang.String>
getPartitionStepNames()
Step
getStep()
java.util.Collection<StepExecution>
handle(StepExecutionSplitter stepSplitter, StepExecution stepExecution)
Main entry point forPartitionHandler
interface.void
setAllowStartIfComplete(boolean allowStartIfComplete)
void
setJobRepository(JobRepository jobRepository)
void
setPartitionAnalyzer(javax.batch.api.partition.PartitionAnalyzer analyzer)
void
setPartitionDataQueue(java.util.Queue<java.io.Serializable> queue)
void
setPartitionLock(java.util.concurrent.locks.ReentrantLock lock)
void
setPartitionMapper(javax.batch.api.partition.PartitionMapper mapper)
void
setPartitions(int partitions)
void
setPollingInterval(int pollingInterval)
void
setPropertyContext(BatchPropertyContext context)
void
setStep(Step step)
void
setThreads(int threads)
构造器详细资料
JsrPartitionHandler
public JsrPartitionHandler()
方法详细资料
getPartitionStepNames
public java.util.Collection<java.lang.String> getPartitionStepNames()
- 返回:
- the names of each partitioned step
setAllowStartIfComplete
public void setAllowStartIfComplete(boolean allowStartIfComplete)
- 参数:
allowStartIfComplete
- flag stating if the step should restart if it was complete in a previous run
setPartitionDataQueue
public void setPartitionDataQueue(java.util.Queue<java.io.Serializable> queue)
- 参数:
queue
-Queue
to receive the output of thePartitionCollector
setPartitionLock
public void setPartitionLock(java.util.concurrent.locks.ReentrantLock lock)
setPropertyContext
public void setPropertyContext(BatchPropertyContext context)
- 参数:
context
-BatchPropertyContext
to resolve partition level step properties
setPartitionMapper
public void setPartitionMapper(javax.batch.api.partition.PartitionMapper mapper)
- 参数:
mapper
-PartitionMapper
used to configure partitioning
setPartitionAnalyzer
public void setPartitionAnalyzer(javax.batch.api.partition.PartitionAnalyzer analyzer)
- 参数:
analyzer
-PartitionAnalyzer
setThreads
public void setThreads(int threads)
- 参数:
threads
- the number of threads to execute the partitions to be run within. The default is the number of partitions.
setPartitions
public void setPartitions(int partitions)
- 参数:
partitions
- the number of partitions to be executed
setJobRepository
public void setJobRepository(JobRepository jobRepository)
- 参数:
jobRepository
-JobRepository
setPollingInterval
public void setPollingInterval(int pollingInterval)
- 参数:
pollingInterval
- the duration of partitions completion polling interval (in milliseconds). The default value is 500ms.
handle
public java.util.Collection<StepExecution> handle(StepExecutionSplitter stepSplitter, StepExecution stepExecution) throws java.lang.Exception
从接口复制的说明:PartitionHandler
Main entry point forPartitionHandler
interface. The splitter creates all the executions that need to be farmed out, along with their input parameters (in the form of theirExecutionContext
). The master step execution is used to identify the partition and group together the results logically.- 指定者:
handle
在接口中PartitionHandler
- 参数:
stepSplitter
- a strategy for generating a collection ofStepExecution
instancesstepExecution
- the master step execution for the whole partition- 返回:
- a collection of completed
StepExecution
instances - 抛出:
java.lang.Exception
- if anything goes wrong. This allows implementations to be liberal and rely on the caller to translate an exception into a step failure as necessary.
createTask
protected java.util.concurrent.FutureTask<StepExecution> createTask(Step step, StepExecution stepExecution)
Creates the task executing the given step in the context of the given execution.- 参数:
step
- the step to executestepExecution
- the given execution- 返回:
- the task executing the given step
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
- 指定者:
afterPropertiesSet
在接口中org.springframework.beans.factory.InitializingBean
- 抛出:
java.lang.Exception