[
http://jira.jboss.com/jira/browse/EJBTHREE-849?page=comments#action_12351781 ]
Brian Stansberry commented on EJBTHREE-849:
-------------------------------------------
A possible solution could be along the lines of this, in StatefulContainer:
@Override
public void invokePrePassivate(BeanContext beanContext)
{
callbackHandler.prePassivate(beanContext);
if (beanContext instanceof StatefulBeanContext)
{
StatefulBeanContext sbc = (StatefulBeanContext) beanContext;
for (StatefulBeanContext nested : sbc.getContains())
{
nested.prePassivate();
}
}
}
@PrePassivate and @PostActivate callbacks not properly handled for
nested SFSBS
-------------------------------------------------------------------------------
Key: EJBTHREE-849
URL:
http://jira.jboss.com/jira/browse/EJBTHREE-849
Project: EJB 3.0
Issue Type: Bug
Affects Versions: EJB 3.0 RC9 - Patch 1
Reporter: Brian Stansberry
Fix For: EJB 3.0 RC10 - FD
For nested SFSBs that do not implement a remote interface, the passivation/activation
callbacks are not properly invoked.
The problem is that the invocation of StatefulBeanContext.prePassivate() and
postActivate() is the responsibility of the bean cache. But, for a nested SFSB without a
remote interface, the cached object is not the real context, it's a proxy
(ProxiedStatefulBeanContext). The real context is separately cached as a contained
element of the parent bean's context.
So, this kind of nested bean is actually passivated/activated as part of
passivation/activation of the parent bean. The callbacks should be invoked at the same
time they are invoked on the parent. Currently the callbacks are invoked when the cache
decides to passivate the proxy context, but the passivation of the proxy context is
meaningless -- it does not result in serializing the bean instance, so it is incorrect to
invoke the callbacks.
See org.jboss.ejb3.test.stateful.unit.NestedBeanUnitTestCase for a demonstration of the
failure.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira