Interface DatabaseUpgradePaginator
-
- All Known Implementing Classes:
DatabaseUpgradePaginatorImpl
@NotThreadSafe public interface DatabaseUpgradePaginator
Utility service for paginating large collections of database entities in upgrade tasks.By definition the paginator is not thread safe. It is expected to be used in a single-threaded environment within an upgrade tasks.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
DatabaseUpgradePaginator.PaginatedDataSupplier<T>
A supplier of pages over a large collection of elements.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> void
forEach(@NotNull DatabaseUpgradePaginator.PaginatedDataSupplier<T> dataSupplier, int pageSize, @NotNull Consumer<T> consumer)
Executes the givenconsumer
for each element of an underlying large collection of elements.<T> void
forEach(@NotNull DatabaseUpgradePaginator.PaginatedDataSupplier<T> dataSupplier, @NotNull Consumer<T> consumer)
Executes the givenconsumer
for each element of an underlying large collection of elements.<T> void
forEachPage(@NotNull DatabaseUpgradePaginator.PaginatedDataSupplier<T> dataSupplier, int pageSize, @NotNull Consumer<Collection<T>> consumer)
Executes the givenconsumer
for each page of an underlying large collection of elements.<T> void
forEachPage(@NotNull DatabaseUpgradePaginator.PaginatedDataSupplier<T> dataSupplier, @NotNull Consumer<Collection<T>> consumer)
Executes the givenconsumer
on each page of an underlying large collection of elements.
-
-
-
Method Detail
-
forEachPage
<T> void forEachPage(@NotNull @NotNull DatabaseUpgradePaginator.PaginatedDataSupplier<T> dataSupplier, @NotNull @NotNull Consumer<Collection<T>> consumer)
Executes the givenconsumer
on each page of an underlying large collection of elements. The elements are fetched using thedataSupplier
page by page, with defaultpageSize
.- Type Parameters:
T
- type of elements iterated over- Parameters:
dataSupplier
- a supplier for fetching paginated data from the actual data sourceconsumer
- action to perform for each page; every call will be wrapped in a separate transaction
-
forEachPage
<T> void forEachPage(@NotNull @NotNull DatabaseUpgradePaginator.PaginatedDataSupplier<T> dataSupplier, int pageSize, @NotNull @NotNull Consumer<Collection<T>> consumer)
Executes the givenconsumer
for each page of an underlying large collection of elements. The elements are fetched using thedataSupplier
page by page, with specifiedpageSize
.- Type Parameters:
T
- type of elements iterated over- Parameters:
dataSupplier
- a supplier for fetching paginated data from the actual data sourcepageSize
- size of each fetched pageconsumer
- action to perform for each page; every call will be wrapped in a separate transaction
-
forEach
<T> void forEach(@NotNull @NotNull DatabaseUpgradePaginator.PaginatedDataSupplier<T> dataSupplier, @NotNull @NotNull Consumer<T> consumer)
Executes the givenconsumer
for each element of an underlying large collection of elements. The elements are fetched using thedataSupplier
page by page, with defaultpageSize
.- Type Parameters:
T
- type of elements iterated over- Parameters:
dataSupplier
- a supplier for fetching paginated data from the actual data sourceconsumer
- action to perform for each element; executed in transactions, one transaction per page
-
forEach
<T> void forEach(@NotNull @NotNull DatabaseUpgradePaginator.PaginatedDataSupplier<T> dataSupplier, int pageSize, @NotNull @NotNull Consumer<T> consumer)
Executes the givenconsumer
for each element of an underlying large collection of elements. The elements are fetched using thedataSupplier
page by page, with specifiedpageSize
.- Type Parameters:
T
- type of elements iterated over- Parameters:
dataSupplier
- a supplier for fetching paginated data from the actual data sourcepageSize
- size of each fetched pageconsumer
- action to perform for each element; executed in transactions, one transaction per page
-
-