Uploaded image for project: 'EJB 3.0'
  1. EJB 3.0
  2. EJBTHREE-849

@PrePassivate and @PostActivate callbacks not properly handled for nested SFSBS

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • AS 4.2.0 GA
    • EJB 3.0 RC9 - Patch 1
    • None
    • None

      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.

            bstansbe@redhat.com Brian Stansberry
            bstansbe@redhat.com Brian Stansberry
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: