[jboss-cvs] JBossAS SVN: r60353 - trunk/ejb3/src/main/org/jboss/ejb3/stateful.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Feb 6 17:50:40 EST 2007
Author: bstansberry at jboss.com
Date: 2007-02-06 17:50:40 -0500 (Tue, 06 Feb 2007)
New Revision: 60353
Modified:
trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulBeanContext.java
Log:
[EJBTHREE-849] Pass @PrePassivate and @PostActivate on to nested children
Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulBeanContext.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulBeanContext.java 2007-02-06 22:49:36 UTC (rev 60352)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulBeanContext.java 2007-02-06 22:50:40 UTC (rev 60353)
@@ -52,6 +52,9 @@
*/
public class StatefulBeanContext extends BaseContext implements Externalizable
{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -102470788178912606L;
+
protected Object id;
protected boolean txSynchronized = false;
@@ -148,18 +151,18 @@
StatefulBeanContext thisPtr = this;
if (propagatedContainedIn.getList() != null)
{
- // if this is a nested stateful bean, within another nested stateful
- // bean
- // we need to create a nested bean context. The nested one will be put
- // in the
- // parents list and owned by it. It is a special class because we do
- // not want
- // to put its state in a marshalled object as we want to maintain
- // object references
- // We also do not want to put the nested context within its containers
- // cache
- // instead, we return a proxy to it that will be stored in its
- // containers cache
+ // This is a nested stateful bean, within another stateful bean.
+ // We need to create a nested bean context. The nested one will
+ // be put in the parent's list and owned by it. It is a special
+ // class because we do not want to put its state in a separate
+ // marshalled object as we want to maintain object references
+ // between it and its parent.
+
+ // We also do not want to put the nested context within its container's
+ // cache. If placed in the cache, it could be independently passivated,
+ // activated and replicated, again breaking object references due to
+ // independent marshalling. Instead, we return a proxy to it that will
+ // be stored in its container's cache
containedIn = propagatedContainedIn.get();
NestedStatefulBeanContext nested = new NestedStatefulBeanContext();
nested.id = id;
@@ -176,11 +179,29 @@
public void prePassivate()
{
getContainer().invokePrePassivate(this);
+
+ // Pass the call on to any nested children
+ if (contains != null)
+ {
+ for (StatefulBeanContext contained : contains)
+ {
+ contained.prePassivate();
+ }
+ }
}
public void postActivate()
{
getContainer().invokePostActivate(this); // handled in getInstance()
+
+ // Pass the call on to any nested children
+ if (contains != null)
+ {
+ for (StatefulBeanContext contained : contains)
+ {
+ contained.postActivate();
+ }
+ }
}
public void popContainedIn()
More information about the jboss-cvs-commits
mailing list