com.atlassian.confluence.core.persistence.hibernate
Class SimpleHibernateBatchOperationManager

java.lang.Object
  extended by com.atlassian.confluence.core.persistence.hibernate.SimpleHibernateBatchOperationManager
All Implemented Interfaces:
BatchOperationManager

public class SimpleHibernateBatchOperationManager
extends java.lang.Object
implements BatchOperationManager

Performs a batch operation in a series of independent transactions containing an arbitrary number of operations (which happens to be 50).

Warning: using this batcher will clear the current session!


Constructor Summary
SimpleHibernateBatchOperationManager(HibernateSessionManager sessionManager)
           
 
Method Summary
<I,O> java.lang.Iterable<O>
performAsBatch(java.lang.Iterable<I> input, int expectedTotal, com.google.common.base.Function<I,O> task)
           
<I,O> java.lang.Iterable<O>
performInChunks(java.lang.Iterable<I> input, int chunkSize, int sizeToCollect, com.google.common.base.Function<java.util.List<I>,java.util.List<O>> task)
          Processes a collection of items in chunks until a given number of processed items is reached, the processed items are then returned.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleHibernateBatchOperationManager

public SimpleHibernateBatchOperationManager(HibernateSessionManager sessionManager)
Method Detail

performAsBatch

public <I,O> java.lang.Iterable<O> performAsBatch(java.lang.Iterable<I> input,
                                                  int expectedTotal,
                                                  com.google.common.base.Function<I,O> task)
Specified by:
performAsBatch in interface BatchOperationManager

performInChunks

public <I,O> java.lang.Iterable<O> performInChunks(java.lang.Iterable<I> input,
                                                   int chunkSize,
                                                   int sizeToCollect,
                                                   com.google.common.base.Function<java.util.List<I>,java.util.List<O>> task)
Description copied from interface: BatchOperationManager
Processes a collection of items in chunks until a given number of processed items is reached, the processed items are then returned. .

Specified by:
performInChunks in interface BatchOperationManager
Parameters:
input - the items to process
chunkSize - the size of the batch
sizeToCollect - the number of processed items to return
task - a function to process the items
Returns:
A list of processed items


Copyright © 2003-2014 Atlassian. All Rights Reserved.