You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by Vladimir Ozerov <vo...@gridgain.com> on 2015/09/18 16:22:05 UTC
Why IgniteAtomicLong is Closeable?
Igniters,
IgniteAtomicLong extends "Closeable" interface. Why? This appears to be
wrong, because normally user expects that Closeable/AutoCloseable resources
are used as follows:
try (Resource r = ...) {
...
}
For IgniteAtomicLong it means creation with immedaite destroy, definitely
not what user expects. I think we must remove "extend Closeable" from all
atomic classes and simply leave "close()" method which cannot be used with
try-with-resources idiom.
Thoughts?
Vladimir.
Re: Why IgniteAtomicLong is Closeable?
Posted by Sergi Vladykin <se...@gmail.com>.
Agree, really strange. Even method close() without Closeable looks
meaningless,
if there is method removed() then it must have paired method remove() but
not close().
Sergi
2015-09-18 17:22 GMT+03:00 Vladimir Ozerov <vo...@gridgain.com>:
> Igniters,
>
> IgniteAtomicLong extends "Closeable" interface. Why? This appears to be
> wrong, because normally user expects that Closeable/AutoCloseable resources
> are used as follows:
>
> try (Resource r = ...) {
> ...
> }
>
> For IgniteAtomicLong it means creation with immedaite destroy, definitely
> not what user expects. I think we must remove "extend Closeable" from all
> atomic classes and simply leave "close()" method which cannot be used with
> try-with-resources idiom.
>
> Thoughts?
>
> Vladimir.
>