Package com.im.df.util.earlyresults
Class EarlyResultsBatcher
- java.lang.Object
-
- com.im.df.util.earlyresults.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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <R> List<? extends R>runQuery(QueryFunction<R> query, IdsListener consumer, long period)Executes the query function to which anEarlyResultsConsumerwill be passed.
-
-
-
Method Detail
-
runQuery
public static <R> List<? extends R> runQuery(QueryFunction<R> query, IdsListener consumer, long period)
Executes the query function to which anEarlyResultsConsumerwill be passed. The notifications to theEarlyResultsConsumerare translated to periodic updates toIdsListener. 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 theEarlyResultsConsumerconsumer- the listener which will be periodically notified about ids found so farperiod- period of the early results notification- Returns:
- the results returned by query
-
-