Le mar. 22 mai 2018 à 13:29, Andriy Redko <[email protected]> a écrit :

> Hi Romain,
>
> As far as I remember, we did the simplest thing possible, by relying on
> beanManager.isNormalScope(bean.getScope()), as per
> https://issues.apache.org/jira/browse/CXF-7336.
> I think the only scope we care is request one, did you run into issues
> with other scopes?
>

well there are two things to keep in mind:

1.  the resource provider is a singleton (for cxf usage)
2. cdi normal scope references are proxies handling the context and
therefore usable as singleton

=> the advtange of 2 is it is way faster than creating a new instance each
time and manage a new context
=> the issue you can get with 2 is that the creational context for normal
scoped beans is managed by the container and you don't have to release
anything if you don't want to breaks some cases
=> the issue with 1 in current form is that we are not thread safe without
my PR and we just fail with NPE in a lot of cases - this is where i was
coming from

Side note: @Depdendent management is undefined, some containers like tomee
decided to handle it request scoped to stay thread safe and current cxf
impl is singleton scoped, it is fine but just something to keep in mind
when trying to write a portable app.

Thanks.
>
> Best Regards,
>     Andriy Redko
>
> Tuesday, May 22, 2018, 4:34:37 AM, you wrote:
>
> RMB> Hi guys,
>
> RMB> why org.apache.cxf.cdi.CdiResourceProvider#isSingleton returns false
> for
> RMB> normal scoped beans? In such a case the instance is a proxy which can
> be
> RMB> considered as a singleton, no?
>
> RMB> Romain Manni-Bucau
> RMB> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> RMB> <https://rmannibucau.metawerx.net/> | Old Blog
> RMB> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> RMB> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> RMB> <
> https://www.packtpub.com/application-development/java-ee-8-high-performance
> >
>
>

Reply via email to