Interface BatchOperationManager

All Known Implementing Classes:
SimpleHibernateBatchOperationManager5

public interface BatchOperationManager
Perform batch operations without any explicit dependency on a particular version of Hibernate or Spring.
  • Method Summary

    Modifier and Type
    Method
    Description
    <I, O> Iterable<O>
    applyInBatches(Iterable<I> input, int batchSize, int expectedTotal, Function<I,O> task)
    Executes a task for each item in a collection in batches with configurable batch size
    <I, O> Iterable<O>
    applyInBatches(Iterable<I> input, int expectedTotal, Function<I,O> task)
    Executes a task for each item in a collection in batches
    <I, O> Iterable<O>
    applyInChunks(Iterable<I> input, int chunkSize, int sizeToCollect, Function<List<I>,@NonNull 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.
  • Method Details

    • applyInBatches

      <I, O> Iterable<O> applyInBatches(Iterable<I> input, int batchSize, int expectedTotal, Function<I,O> task)
      Executes a task for each item in a collection in batches with configurable batch size
      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
      Since:
      7.0.1
    • applyInBatches

      <I, O> Iterable<O> applyInBatches(Iterable<I> input, int expectedTotal, Function<I,O> task)
      Executes a task for each item in a collection in batches
      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
      Since:
      7.0.1
    • applyInChunks

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