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

Nested SFSB that declares @Remote does not have a dependent lifecycle

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • AS 4.2.0 GA
    • EJB 3.0 RC9 - Patch 1
    • None
    • None

    Description

      Per forum thread:

      Bill Burke wrote:

      Nested SFSBs have to share the same lifecycle as their parents. They also have to share the same Extended Persistence Contexts the reference!

      Brian Stansberry wrote:

      This is broken if the nested SFSB declares @Remote. This test fails:

      Code:

      ParentStatefulRemote stateful = (ParentStatefulRemote) ctx.lookup("testParentStateful/remote");

      assertEquals("Counter: ", 1, stateful.increment());

      NestedStateful nested = stateful.getNested();

      stateful.remove();

      // Confirm nested no longer works following parent remove
      try
      {
      nested.increment();
      fail("Nested bean still exists following destruction of parent");
      }
      catch (Exception good)
      {
      // this is what we want – nested has no independent lifecycle
      }

      I've been digging around trying to understand what's going on. For some reason, if the nested bean declares @Remote, when a StatefulCache calls Pool.get(), it gets back a standard StatefulBeanContext rather ProxiedStatefulBeanContext. This has to be a function of how calls are nested (i.e. the nested bean gets created before the parent, thus the parent hasn't been pushed onto the ThreadLocalStack when the nested bean is created.)

      Test that fails is org.jboss.ejb3.test.stateful.unit.NestedBeanUnitTestCase.testDependentLifecycle().

      Attachments

        Issue Links

          Activity

            People

              rhn-engineering-cdewolf Carlo de Wolf
              bstansbe@redhat.com Brian Stansberry
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: