Class EarlyResultsBatcher


  • public final class EarlyResultsBatcher
    extends Object
    The utility which allows to call query and receive early results in batches, periodically, not whenever any new result appears.
    • Method Detail

      • runQuery

        public static <R> List<? extends R> runQuery​(QueryFunction<R> query,
                                                     IdsListener consumer,
                                                     long period)
        Executes the query function to which an EarlyResultsConsumer will be passed. The notifications to the EarlyResultsConsumer are translated to periodic updates to IdsListener. The listener will be notified only if there are any new results when the period elapses.
        Type Parameters:
        R - type of query results
        Parameters:
        query - query which uses the EarlyResultsConsumer
        consumer - the listener which will be periodically notified about ids found so far
        period - period of the early results notification
        Returns:
        the results returned by query