Package com.redwood.scheduler.api.uow
Class SchedulerSessionBatchedUnitOfWorkManager
- java.lang.Object
-
- com.redwood.scheduler.api.uow.SchedulerSessionBatchedUnitOfWorkManager
-
public class SchedulerSessionBatchedUnitOfWorkManager extends Object
Extending the unit-of-work pattern, this class allows large amounts of work to be processed in batches.- See Also:
SchedulerSessionUnitOfWork
-
-
Constructor Summary
Constructors Constructor Description SchedulerSessionBatchedUnitOfWorkManager(SchedulerSessionUnitOfWorkManager newUowManager, int newBatchSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
getBatchSize()
protected SchedulerSessionUnitOfWorkManager
getUnitOfWorkManager()
<T> void
perform(SchedulerSessionBatchedUnitOfWork<T> buow)
Execute batched units of work.protected <T> void
processBatch(SchedulerSessionBatchedUnitOfWork<T> buow, com.redwood.scheduler.api.model.SchedulerSession session, Iterator<T> batch)
-
-
-
Constructor Detail
-
SchedulerSessionBatchedUnitOfWorkManager
public SchedulerSessionBatchedUnitOfWorkManager(SchedulerSessionUnitOfWorkManager newUowManager, int newBatchSize)
- Parameters:
newUowManager
-newBatchSize
-
-
-
Method Detail
-
perform
public <T> void perform(SchedulerSessionBatchedUnitOfWork<T> buow) throws Exception
Execute batched units of work.- Parameters:
buow
- The class to use to perform the batched work.- Throws:
com.redwood.scheduler.api.exception.SchedulerAPIPersistenceException
- If the batch of work fails to be processed enough times in a row the last thrown exception will be propagated. (The number of times is the maximum number of times the configuredSchedulerSessionUnitOfWorkManager
will retry a unit of work.)Exception
- If an error occurs
-
getUnitOfWorkManager
protected SchedulerSessionUnitOfWorkManager getUnitOfWorkManager()
-
getBatchSize
protected int getBatchSize()
-
processBatch
protected <T> void processBatch(SchedulerSessionBatchedUnitOfWork<T> buow, com.redwood.scheduler.api.model.SchedulerSession session, Iterator<T> batch) throws InterruptedException
- Throws:
InterruptedException
-
-