Why IgniteAtomicLong is Closeable?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Why IgniteAtomicLong is Closeable?

Vladimir Ozerov
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.
Reply | Threaded
Open this post in threaded view
|

Re: Why IgniteAtomicLong is Closeable?

Sergi
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 <[hidden email]>:

> 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.
>