Author: arne
Date: Sat Apr 6 20:11:19 2013
New Revision: 1465294
URL: http://svn.apache.org/r1465294
Log:
OWB-766: Removed public static ThreadLocal
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InstanceProducer.java
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java?rev=1465294&r1=1465293&r2=1465294&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
Sat Apr 6 20:11:19 2013
@@ -40,7 +40,6 @@ import org.apache.webbeans.container.Bea
import org.apache.webbeans.container.InjectionResolver;
import org.apache.webbeans.context.creational.CreationalContextImpl;
import org.apache.webbeans.portable.InjectionPointProducer;
-import org.apache.webbeans.portable.InstanceProducer;
import org.apache.webbeans.util.ClassUtil;
import org.apache.webbeans.util.WebBeansUtil;
@@ -82,15 +81,10 @@ public abstract class AbstractInjectable
InjectionResolver instance = beanManager.getInjectionResolver();
Bean<?> injectedBean = instance.getInjectionPointBean(injectionPoint);
- if(isInstanceProviderInjection(injectionPoint))
- {
- InstanceProducer.local.set(injectionPoint);
- }
-
- else if(isEventProviderInjection(injectionPoint))
+ if (isInstanceProviderInjection(injectionPoint) ||
isEventProviderInjection(injectionPoint))
{
creationalContext.putInjectionPoint(injectionPoint);
- }
+ }
boolean injectionPointBeanLocalSetOnStack = false;
try
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InstanceProducer.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InstanceProducer.java?rev=1465294&r1=1465293&r2=1465294&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InstanceProducer.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InstanceProducer.java
Sat Apr 6 20:11:19 2013
@@ -28,12 +28,11 @@ import javax.enterprise.inject.Instance;
import javax.enterprise.inject.spi.InjectionPoint;
import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
import org.apache.webbeans.inject.instance.InstanceImpl;
public class InstanceProducer<T> extends AbstractProducer<Instance<T>>
{
- // TODO refactor. public static variables are uterly ugly
- public static ThreadLocal<InjectionPoint> local = new
ThreadLocal<InjectionPoint>();
private Class<Instance<T>> returnType;
private Set<Annotation> qualifiers;
private WebBeansContext webBeansContext;
@@ -50,7 +49,12 @@ public class InstanceProducer<T> extends
{
try
{
- InjectionPoint injectionPoint = local.get();
+ InjectionPoint injectionPoint = null;
+ //TODO What should we do here if creationalContext is not
instanceof CreationalContextImpl?
+ if (creationalContext instanceof CreationalContextImpl)
+ {
+ injectionPoint =
((CreationalContextImpl<Instance<T>>)creationalContext).getInjectionPoint();
+ }
Set<Annotation> qualifiers;
Type type;
@@ -72,8 +76,10 @@ public class InstanceProducer<T> extends
}
finally
{
- local.set(null);
- local.remove();
+ if (creationalContext instanceof CreationalContextImpl)
+ {
+
((CreationalContextImpl<Instance<T>>)creationalContext).removeInjectionPoint();
+ }
}
}
}