Class SimpleHibernateBatchOperationManager5

java.lang.Object
com.atlassian.confluence.impl.hibernate.SimpleHibernateBatchOperationManager5
All Implemented Interfaces:
BatchOperationManager

@Transactional public class SimpleHibernateBatchOperationManager5 extends Object implements BatchOperationManager
Provides methods for performing batch operations in a series of independent transactions.

WARNING: Methods in this batching manager may clear the current session! It was added as a successor of SimpleHibernateBatchOperationManager because of Hibernate 2 removal.

Since:
7.16.0
  • Constructor Details

    • SimpleHibernateBatchOperationManager5

      public SimpleHibernateBatchOperationManager5(HibernateSessionManager5 sessionManager)
  • Method Details

    • applyInBatches

      public <I, O> Iterable<O> applyInBatches(Iterable<I> input, int batchSize, int expectedTotal, Function<I,O> task)
      Description copied from interface: BatchOperationManager
      Executes a task for each item in a collection in batches with configurable batch size
      Specified by:
      applyInBatches in interface BatchOperationManager
      Type Parameters:
      I - input type
      O - output type
      Parameters:
      input - the items to process
      batchSize - the size of the batch
      expectedTotal - the expected number of items to process
      task - a function to process the items
      Returns:
      list of task outputs of specified type
    • applyInBatches

      public <I, O> Iterable<O> applyInBatches(Iterable<I> input, int expectedTotal, Function<I,O> task)
      Description copied from interface: BatchOperationManager
      Executes a task for each item in a collection in batches
      Specified by:
      applyInBatches in interface BatchOperationManager
      Type Parameters:
      I - input type
      O - output type
      Parameters:
      input - the items to process
      expectedTotal - the expected number of items to process
      task - a function to process the items
      Returns:
      list of task outputs of specified type
    • applyInChunks

      public <I, O> Iterable<O> applyInChunks(Iterable<I> input, int chunkSize, int sizeToCollect, Function<List<I>,@NonNull 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:
      applyInChunks 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