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
Constructors Constructor Description SimpleHibernateBatchOperationManager5(HibernateSessionManager5 sessionManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods 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.<I,O>
Iterable<O>performAsBatch(Iterable<I> input, int batchSize, int expectedTotal, com.google.common.base.Function<I,O> task)
Deprecated.since 7.16.0.<I,O>
Iterable<O>performAsBatch(Iterable<I> input, int expectedTotal, com.google.common.base.Function<I,O> task)
Deprecated.since 7.0.1.<I,O>
Iterable<O>performInChunks(Iterable<I> input, int chunkSize, int sizeToCollect, com.google.common.base.Function<List<I>,@NonNull List<O>> task)
Deprecated.since 7.0.1.
-
-
-
Constructor Detail
-
SimpleHibernateBatchOperationManager5
public SimpleHibernateBatchOperationManager5(HibernateSessionManager5 sessionManager)
-
-
Method Detail
-
performAsBatch
@Deprecated public <I,O> Iterable<O> performAsBatch(Iterable<I> input, int batchSize, int expectedTotal, com.google.common.base.Function<I,O> task)
Deprecated.since 7.16.0. UseapplyInBatches(Iterable, int, int, Function)
Executes a task for each item in a collection in batches with configurable batch sizeWARNING: This method will clear the current session! The session clearing will discard any unflushed or uncommitted changes made higher in the stack. Calls to this method should generally be done in a separate thread or otherwise outside the scope of a request.
- Specified by:
performAsBatch
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
- Since:
- 7.16.0 added as deprecated because the interface still requires it.
-
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
-
performAsBatch
@Deprecated public <I,O> Iterable<O> performAsBatch(Iterable<I> input, int expectedTotal, com.google.common.base.Function<I,O> task)
Deprecated.since 7.0.1. UseapplyInBatches(Iterable, int, Function)
Executes a task for each item in a collection in batchesWARNING: This method will clear the current session! The session clearing will discard any unflushed or uncommitted changes made higher in the stack. Calls to this method should generally be done in a separate thread or otherwise outside the scope of a request.
- Specified by:
performAsBatch
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
-
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 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
-
performInChunks
@Deprecated public <I,O> Iterable<O> performInChunks(Iterable<I> input, int chunkSize, int sizeToCollect, com.google.common.base.Function<List<I>,@NonNull List<O>> task)
Deprecated.since 7.0.1. UseapplyInChunks(Iterable, int, int, Function)
Processes a collection of items in chunks until a given number of processed items is reached, the processed items are then returned.This method does NOT perform batch operations in independent transactions. To do so, transactions will need to be handled by the provided processing function. Alternatively, consider using
BatchOperationManager.applyInBatches(Iterable, int, Function)
- Specified by:
performInChunks
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
-
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
-
-