You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by GitBox <gi...@apache.org> on 2018/05/23 06:44:58 UTC

[GitHub] rmannibucau commented on a change in pull request #418: CXF-7742 handling scopes in CdiResourceProvider

rmannibucau commented on a change in pull request #418: CXF-7742 handling scopes in CdiResourceProvider
URL: https://github.com/apache/cxf/pull/418#discussion_r190137393
 
 

 ##########
 File path: integration/cdi/src/main/java/org/apache/cxf/cdi/JAXRSCdiResourceExtension.java
 ##########
 @@ -372,7 +379,14 @@ private ClassifiedClasses classes2singletons(final Application application, fina
 
             for (final Bean< ? > bean: serviceBeans) {
                 if (classes.contains(bean.getBeanClass())) {
-                    classified.addResourceProvider(new CdiResourceProvider(beanManager, bean));
+                    final CdiResourceProvider provider = new CdiResourceProvider(beanManager, bean);
+                    // if not a singleton we manage it per request
+                    // if @Singleton the container handles it
+                    // so we only need this case here
+                    if (provider.isSingleton() && Dependent.class == bean.getScope()) {
+                        disposableResourceProviders.add(provider);
 
 Review comment:
   Oh good catch, copied the pattern of disposableCreationalContexts but actually we don't need that for that list which is just used in the context of the extension so thread safe, will clean up

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services