T
- the type of item that will be in the batchespublic class WorkSourceBatchRunner<T> extends Object
This class is typically the basis for upgrade or migration tasks that need to manipulate a large amount of content.
It will use a parameterised number of worker threads to operate on batches of content as specified by a supplied
BatchableWorkSource
.
Each batch of work will occur within its own transaction.
Constructor and Description |
---|
WorkSourceBatchRunner(String threadName,
int numThreads,
org.springframework.transaction.PlatformTransactionManager transactionManager) |
Modifier and Type | Method and Description |
---|---|
List<Exception> |
run(BatchableWorkSource<T> workSource,
BatchTask<T> task)
Begin executing against all the work in the supplied work source.
|
protected List<Exception> |
run(BatchableWorkSource<T> workSource,
BatchTask<T> task,
ExecutorService executor)
Exposed (as protected) to allow specification of the executor in unit tests.
|
void |
setProgressWrapper(com.atlassian.core.util.ProgressMeter progress) |
void |
shutdown()
Deprecated.
since 5.2. The executor will be constructed and shutdown during the run.
|
public WorkSourceBatchRunner(String threadName, int numThreads, org.springframework.transaction.PlatformTransactionManager transactionManager)
protected List<Exception> run(BatchableWorkSource<T> workSource, BatchTask<T> task, ExecutorService executor) throws ExecutionException, InterruptedException
workSource
- task
- executor
- ExecutionException
InterruptedException
public List<Exception> run(BatchableWorkSource<T> workSource, BatchTask<T> task) throws ExecutionException, InterruptedException
workSource
- task
- the task to be run on each item in the batches from the work sourceExecutionException
InterruptedException
Exception
- if there is any problem out with the actual execution of the the BatchTasks. (Problems within the
BatchTask are returned in the List of Exceptions.)@Deprecated public void shutdown()
public void setProgressWrapper(com.atlassian.core.util.ProgressMeter progress)
Copyright © 2003–2017 Atlassian. All rights reserved.