You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by Pavel Tupitsyn <pt...@apache.org> on 2022/06/24 15:24:14 UTC

IgniteSet, thin client, and WeakReferenceCloseableIterator

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

Re: IgniteSet, thin client, and WeakReferenceCloseableIterator

Posted by Pavel Tupitsyn <pt...@apache.org>.
Thanks for your input, I prefer the AutoCloseable approach too.

On Sun, Jun 26, 2022 at 4:45 PM Igor Sapego <is...@apache.org> wrote:

> 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 <
> alexpolovtcev@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 <pt...@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
> >
>

Re: IgniteSet, thin client, and WeakReferenceCloseableIterator

Posted by Igor Sapego <is...@apache.org>.
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 <al...@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 <pt...@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
>

Re: IgniteSet, thin client, and WeakReferenceCloseableIterator

Posted by Alexander Polovtcev <al...@gmail.com>.
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 <pt...@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