public class

WorkSourceBatchRunner

extends Object
java.lang.Object
   ↳ com.atlassian.confluence.content.render.xhtml.migration.WorkSourceBatchRunner<T>

Class Overview

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.

Summary

Public Constructors
WorkSourceBatchRunner(String threadName, int numThreads, PlatformTransactionManager transactionManager)
Protected Constructors
WorkSourceBatchRunner(PlatformTransactionManager transactionManager, ExecutorService executor)
Constructor with injectable executor, exposed for unit tests
Public Methods
List<Exception> run(BatchableWorkSource<T> workSource, BatchTask<T> task)
Begin executing against all the work in the supplied work source.
void setProgressWrapper(ProgressMeter progress)
void shutdown()
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public WorkSourceBatchRunner (String threadName, int numThreads, PlatformTransactionManager transactionManager)

Protected Constructors

protected WorkSourceBatchRunner (PlatformTransactionManager transactionManager, ExecutorService executor)

Constructor with injectable executor, exposed for unit tests

Public Methods

public List<Exception> run (BatchableWorkSource<T> workSource, BatchTask<T> task)

Begin executing against all the work in the supplied work source. One or more threads will be spawned to perform the work but this method will wait until all threads have finished before it returns.

Parameters
task the task to be run on each item in the batches from the work source
Returns
  • a list of any individual exceptions that occurred as the WorkSourceTask was executing. An empty list will be returned if there are no exceptions.
Throws
ExecutionException
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.)

public void setProgressWrapper (ProgressMeter progress)

public void shutdown ()