Hi,
In our platform, we use the o.a.s.e.j.JobManager API signature:
Collection<Job> findJobs(QueryType type, String topic, long limit,
Map<String, Object>... templates);
This signature and its implementation are fine except in cases where the
number of returned jobs is very large.
In those cases, the implementation can run the instance OOM because the
heap is consumed by the collection of jobs to be returned.
Instead of building the whole list in memory, we could instead stream the
set of jobs to be returned, thus allowing the API consumer to avoid the OOM.
This streaming behaviour would only be efficient if all the calls
implementing the signature do stream the result all the way down.
Looking at the JobManager#findJobs implementation, it seems this is the
case.
So, I suggest we add a method signature in JobManager API that allows to
return an Iterator or an Iterable.
Adding a signature to the JobManager would be a backward compatible change
as the JobManager is a provider type.
wdyt ?
Regards,
Timothee