I like the closable iterator approach more as well. The difference in API
is not as critical in my opinion, as we have a lot of differences in thick
and
thin APIs already and users would normally seek thin client examples and
not just re-use thick client code with thin client.

Best Regards,
Igor


On Fri, Jun 24, 2022 at 7:35 PM Alexander Polovtcev <alexpolovt...@gmail.com>
wrote:

> I would personally prefer the closeable iterator approach, since it is what
> most Java libraries use and most users should be familiar with it. Also
> most IDEs will warn you, if you don't close an AutoCloseable.
>
> On Fri, Jun 24, 2022 at 6:24 PM Pavel Tupitsyn <ptupit...@apache.org>
> wrote:
>
> > Igniters,
> >
> > I'm working on IgniteSet in Java thin client [1], and I'm not sure how to
> > deal with iterator release.
> >
> > On the "thick" API side we use WeakReferenceCloseableIterator [2] to
> > release iterator resources automatically when the iterator instance is
> > claimed by GC.
> >
> > a) Reuse this on the client side somehow.
> >     Pros: consistent behavior, fool-proof
> >     Cons: complexity, nondeterministic resource release
> >
> > b) Make client-side iterator AutoCloseable
> >     Pros: simple, deterministic
> >     Cons: error-prone for users, not consistent with thick API
> >
> > Thoughts?
> >
> >
> > [1] https://issues.apache.org/jira/browse/IGNITE-16897
> > [2]
> >
> >
> https://github.com/apache/ignite/blob/71ff768ac98b3411fee876d42cad9689f1b16c2a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheWeakQueryIteratorsHolder.java#L350
> >
>
>
> --
> With regards,
> Aleksandr Polovtcev
>

Reply via email to