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 Summary
ConstructorsConstructorDescriptionSimpleHibernateBatchOperationManager5
(HibernateSessionManager5 sessionManager) -
Method Summary
Modifier and TypeMethodDescription<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.
-
Constructor Details
-
SimpleHibernateBatchOperationManager5
-
-
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 interfaceBatchOperationManager
- Type Parameters:
I
- input typeO
- output type- Parameters:
input
- the items to processbatchSize
- the size of the batchexpectedTotal
- the expected number of items to processtask
- a function to process the items- Returns:
- list of task outputs of specified type
-
applyInBatches
Description copied from interface:BatchOperationManager
Executes a task for each item in a collection in batches- Specified by:
applyInBatches
in interfaceBatchOperationManager
- Type Parameters:
I
- input typeO
- output type- Parameters:
input
- the items to processexpectedTotal
- the expected number of items to processtask
- 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 interfaceBatchOperationManager
- Parameters:
input
- the items to processchunkSize
- the size of the batchsizeToCollect
- the number of processed items to returntask
- a function to process the items- Returns:
- A list of processed items
-