Author: struberg
Date: Tue Jul 19 15:07:49 2011
New Revision: 1148386
URL: http://svn.apache.org/viewvc?rev=1148386&view=rev
Log:
OWB-594 fix broken @ApplicationScoped bean caching
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ApplicationScopedBeanIntereptorHandler.java
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ApplicationScopedBeanIntereptorHandler.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ApplicationScopedBeanIntereptorHandler.java?rev=1148386&r1=1148385&r2=1148386&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ApplicationScopedBeanIntereptorHandler.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ApplicationScopedBeanIntereptorHandler.java
Tue Jul 19 15:07:49 2011
@@ -24,7 +24,7 @@ import org.apache.webbeans.component.Owb
/**
- * <p>This is a {@link javassist.util.proxy.MethodHandler.MethodHandler}
especially
+ * <p>This is a {@link javassist.util.proxy.MethodHandler} especially
* made for @ApplicationScoped beans.</p>
*
* <p>Since there is only one single contextual instance of an
@ApplicationScoped bean,
@@ -36,7 +36,13 @@ public class ApplicationScopedBeanIntere
/**default serial id*/
private static final long serialVersionUID = 1L;
- /**Cached bean instance*/
+ /**
+ * Cached bean instance. Please note that it is only allowed to
+ * use this special proxy if you don't use OpenWebBeans in an EAR
+ * scenario. In this case we must not cache @ApplicationScoped
+ * contextual instances because they could be injected into EJBs or other
+ * shared instances which span over multiple web-apps.
+ */
private transient Object cachedInstance = null;
/**
@@ -52,7 +58,7 @@ public class ApplicationScopedBeanIntere
/**
* {@inheritDoc}
*/
- protected Object getContextualInstance(OwbBean<Object> bean)
+ protected Object getContextualInstance()
{
if (cachedInstance == null)
{