jsr367-experts@jsonb-spec.java.net

[jsr367-experts] Re: Jsonb AutoCloseable?

From: Romain Manni-Bucau <rmannibucau_at_tomitribe.com>
Date: Sat, 30 Jan 2016 21:25:57 +0100

Jsonb runtime can - as most EE spec today - get CDI bean manager with CDI
class and retrieve a cdi bean directly. Issue is for not normal scope
beans, there is a release() call at the end of the usage to avoid to leak
and finish the bean lifecycle.
Le 30 janv. 2016 21:10, "Roman Grigoriadi" <roman.grigoriadi_at_oracle.com> a
écrit :

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