You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by ar...@apache.org on 2013/04/07 19:41:22 UTC
svn commit: r1465433 - in
/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container:
BeanManagerImpl.java InjectionResolver.java
Author: arne
Date: Sun Apr 7 17:41:22 2013
New Revision: 1465433
URL: http://svn.apache.org/r1465433
Log:
OWB-766: Removed remaining ThreadLocals that were needed for injection
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=1465433&r1=1465432&r2=1465433&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java Sun Apr 7 17:41:22 2013
@@ -72,7 +72,6 @@ import org.apache.webbeans.component.Inj
import org.apache.webbeans.component.JmsBeanMarker;
import org.apache.webbeans.component.NewBean;
import org.apache.webbeans.component.OwbBean;
-import org.apache.webbeans.component.WebBeansType;
import org.apache.webbeans.component.creation.BeanAttributesBuilder;
import org.apache.webbeans.component.third.ThirdpartyBeanImpl;
import org.apache.webbeans.config.WebBeansContext;
@@ -88,7 +87,6 @@ import org.apache.webbeans.plugins.OpenW
import org.apache.webbeans.portable.AnnotatedElementFactory;
import org.apache.webbeans.portable.InjectionTargetImpl;
import org.apache.webbeans.portable.events.discovery.ErrorStack;
-import org.apache.webbeans.spi.ScannerService;
import org.apache.webbeans.spi.adaptor.ELAdaptor;
import org.apache.webbeans.spi.plugins.OpenWebBeansEjbPlugin;
import org.apache.webbeans.util.AnnotationUtil;
@@ -608,32 +606,6 @@ public class BeanManagerImpl implements
//Find the injection point Bean
Bean<Object> injectedBean = (Bean<Object>)injectionResolver.getInjectionPointBean(injectionPoint);
- boolean isSetIPForProducers=false;
- ScannerService scannerService = webBeansContext.getScannerService();
- if ((scannerService != null && scannerService.isBDABeansXmlScanningEnabled()))
- {
- if (injectedBean instanceof AbstractOwbBean<?>)
- {
- AbstractOwbBean<?> aob = (AbstractOwbBean) injectedBean;
- if (aob.getWebBeansType() == WebBeansType.PRODUCERFIELD || aob.getWebBeansType() == WebBeansType.PRODUCERMETHOD)
- {
- // There is no way to pass the injection point for producers
- // without significant refactoring, so set injection point
- // on
- // InjectionResolver to properly handle alternative
- // producers
- // per BDA.
- isSetIPForProducers = true;
- }
- }
- }
- if (isSetIPForProducers)
- {
- // retrieve injection point from thread local for alternative
- // producers
- InjectionResolver.injectionPoints.set(injectionPoint);
- }
-
if(WebBeansUtil.isDependent(injectedBean))
{
if (!(ownerCreationalContext instanceof CreationalContextImpl))
@@ -667,13 +639,6 @@ public class BeanManagerImpl implements
}
}
- if(isSetIPForProducers)
- {
- //remove reference immediate after instance is retrieved
- InjectionResolver.injectionPoints.set(null);
- InjectionResolver.injectionPoints.remove();
- }
-
return instance;
}
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java?rev=1465433&r1=1465432&r2=1465433&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java Sun Apr 7 17:41:22 2013
@@ -87,9 +87,6 @@ public class InjectionResolver
*/
private Map<String, Set<Bean<?>>> resolvedBeansByName = new ConcurrentHashMap<String, Set<Bean<?>>>();
- //X TODO refactor. public static variables are utterly ugly
- public static ThreadLocal<InjectionPoint> injectionPoints = new ThreadLocal<InjectionPoint>();
-
/**
* Creates a new injection resolve for given bean manager.
*
@@ -444,22 +441,13 @@ public class InjectionResolver
* @param qualifiers qualifiers of the injection point
* @return set of resolved beans
*/
- public Set<Bean<?>> implResolveByType(Type injectionPointType, Class<?> injectinPointClass, Annotation... qualifiers)
+ public Set<Bean<?>> implResolveByType(Type injectionPointType, Class<?> injectionPointClass, Annotation... qualifiers)
{
ScannerService scannerService = webBeansContext.getScannerService();
String bdaBeansXMLFilePath = null;
if (scannerService.isBDABeansXmlScanningEnabled())
{
- if (injectinPointClass == null)
- {
- // Retrieve ip from thread local for producer case
- InjectionPoint ip = injectionPoints.get();
- if (ip != null)
- {
- injectinPointClass = ip.getBean().getBeanClass();
- }
- }
- bdaBeansXMLFilePath = getBDABeansXMLPath(injectinPointClass);
+ bdaBeansXMLFilePath = getBDABeansXMLPath(injectionPointClass);
}
boolean currentQualifier = false;