users@jsonb-spec.java.net

[jsonb-spec users] [jsr367-experts] Re: Jsonb AutoCloseable?

From: Roman Grigoriadi <roman.grigoriadi_at_oracle.com>
Date: Sat, 30 Jan 2016 21:10:54 +0100

You are correct, in case of @JsonbTypeAdapter it would be a problem, but
in such case adapter would not be instantiated and managed by a
container. How dependencies will be injicted inside?

Roman



On 01/30/2016 07:19 PM, Romain Manni-Bucau wrote:
> How would you do with @JsonbTypeAdapter(MyAdapter.class)? Agree
> withAdapters(xxxx) shouldnt be handled by jsonb itself.
>
>
> Romain Manni-Bucau
> @rmannibucau
> http://www.tomitribe.com
> http://rmannibucau.wordpress.com
> https://github.com/rmannibucau
>
> 2016-01-30 18:54 GMT+01:00 Roman Grigoriadi
> <roman.grigoriadi_at_oracle.com <mailto:roman.grigoriadi_at_oracle.com>>:
>
> Hi Romain,
>
> I am not sure about Autoclosable on Jsonb. Jsonb instance is
> designed to be threadsafe and is able to be set into a field as a
> depenency of a container managed bean. A jsonbConfig with adapters
> is stored inside and is shared between threads which are using
> such Jsonb instance. It is not supposed to be disposed and created
> again each method call in the same component bean.
>
> Anyway after jsonb instance is not needed anymore and a cleanup
> must be done on adapters which are instantiated and injected by
> some container, can't you just hook cleanup of them on such
> container managed bean lifecycle? You can implement any interface
> besides JsonbAdapter or annotate any additional method for
> cleanup, so the Jsonb instance don't have to propagate cleanup on
> its adapters. Would it be good enough?
>
> Regards,
> Roman
>
>
> On 01/29/2016 02:19 PM, Romain Manni-Bucau wrote:
>
> Hi guys,
>
> if we add CDI support to adapters we'll need Jsonb to be
> closeable to be able to cleanup CDI context.
>
> Is that something we can get?
>
> Romain Manni-Bucau
> @rmannibucau
> http://www.tomitribe.com
> http://rmannibucau.wordpress.com
> https://github.com/rmannibucau
>
>
>