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.

    • Method Detail

      • forEachPage

        <T> void forEachPage​(@NotNull
                             @NotNull DatabaseUpgradePaginator.PaginatedDataSupplier<T> dataSupplier,
                             @NotNull
                             @NotNull Consumer<Collection<T>> consumer)
        Executes the given consumer on each page of an underlying large collection of elements. The elements are fetched using the dataSupplier page by page, with default pageSize.
        Type Parameters:
        T - type of elements iterated over
        Parameters:
        dataSupplier - a supplier for fetching paginated data from the actual data source
        consumer - 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 given consumer for each page of an underlying large collection of elements. The elements are fetched using the dataSupplier page by page, with specified pageSize.
        Type Parameters:
        T - type of elements iterated over
        Parameters:
        dataSupplier - a supplier for fetching paginated data from the actual data source
        pageSize - size of each fetched page
        consumer - 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 given consumer for each element of an underlying large collection of elements. The elements are fetched using the dataSupplier page by page, with default pageSize.
        Type Parameters:
        T - type of elements iterated over
        Parameters:
        dataSupplier - a supplier for fetching paginated data from the actual data source
        consumer - 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 given consumer for each element of an underlying large collection of elements. The elements are fetched using the dataSupplier page by page, with specified pageSize.
        Type Parameters:
        T - type of elements iterated over
        Parameters:
        dataSupplier - a supplier for fetching paginated data from the actual data source
        pageSize - size of each fetched page
        consumer - action to perform for each element; executed in transactions, one transaction per page