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

No pooling for stateless session beans

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • EJB 3.0 RC9 - FD
    • EJB 3.0 RC8 - FD
    • EJB3 Extensions
    • None

      Scenario:
      Client VM calls a method on a EJB 2 Stateful Session Bean (SFSB) via the remote interface in a loop for 1000 times.Transaction starts on the application server. The SFSB method calls a method on a EJB3 Stateless Session Bean (SLSB) - via the remote interface (local interface makes no difference).

      The print out in the PostConstruct callback method of the EJB3 SLSB shows us, that a new bean instance was created for each of the 1000 method calls. Because of ThreadLocal pooling approach, we print out the Thread id too to show, that we always have the same Thread for each method call.

      CallBack method:
      /**

      • EJBCreate method.
        */
        @PostConstruct
        public void ejb3Create() { System.out.println("New SessionBean " + this); System.out.println("Thread " + Thread.currentThread().getId()); setupBean(); }

      And the log for a few of the 1000 calls:
      ...
      09:17:51,119 INFO [STDOUT] New SessionBean com.jcoffee.components.um3.UserManagementComponent3@231ae2
      09:17:51,129 INFO [STDOUT] Thread 97
      09:17:51,139 INFO [STDOUT] New SessionBean com.jcoffee.components.um3.UserManagementComponent3@1662174
      09:17:51,139 INFO [STDOUT] Thread 97
      09:17:51,219 INFO [STDOUT] New SessionBean com.jcoffee.components.um3.UserManagementComponent3@189f155
      09:17:51,219 INFO [STDOUT] Thread 97
      09:17:51,239 INFO [STDOUT] New SessionBean com.jcoffee.components.um3.UserManagementComponent3@1a82dfb
      09:17:51,239 INFO [STDOUT] Thread 97
      09:17:51,289 INFO [STDOUT] New SessionBean com.jcoffee.components.um3.UserManagementComponent3@198813a
      09:17:51,289 INFO [STDOUT] Thread 97
      09:17:51,309 INFO [STDOUT] New SessionBean com.jcoffee.components.um3.UserManagementComponent3@59eefd
      09:17:51,309 INFO [STDOUT] Thread 97
      09:17:51,359 INFO [STDOUT] New SessionBean com.jcoffee.components.um3.UserManagementComponent3@2e3520
      09:17:51,369 INFO [STDOUT] Thread 97
      09:17:51,379 INFO [STDOUT] New SessionBean com.jcoffee.components.um3.UserManagementComponent3@1ed457
      09:17:51,379 INFO [STDOUT] Thread 97
      09:17:51,439 INFO [STDOUT] New SessionBean com.jcoffee.components.um3.UserManagementComponent3@1e1c7f3
      09:17:51,439 INFO [STDOUT] Thread 97
      09:17:51,449 INFO [STDOUT] New SessionBean com.jcoffee.components.um3.UserManagementComponent3@15cb8ed
      09:17:51,449 INFO [STDOUT] Thread 97
      09:17:51,519 INFO [STDOUT] New SessionBean com.jcoffee.components.um3.UserManagementComponent3@1a4a949
      09:17:51,519 INFO [STDOUT] Thread 97
      09:17:51,529 INFO [STDOUT] New SessionBean com.jcoffee.components.um3.UserManagementComponent3@19ae0a
      09:17:51,529 INFO [STDOUT] Thread 97
      09:17:51,589 INFO [STDOUT] New SessionBean com.jcoffee.components.um3.UserManagementComponent3@567fa0
      09:17:51,599 INFO [STDOUT] Thread 97
      09:17:51,609 INFO [STDOUT] New SessionBean com.jcoffee.components.um3.UserManagementComponent3@19956fe
      09:17:51,609 INFO [STDOUT] Thread 97
      09:17:51,659 INFO [STDOUT] New SessionBean com.jcoffee.components.um3.UserManagementComponent3@150e574
      09:17:51,669 INFO [STDOUT] Thread 97
      09:17:51,679 INFO [STDOUT] New SessionBean com.jcoffee.components.um3.UserManagementComponent3@aa46ad
      09:17:51,679 INFO [STDOUT] Thread 97
      ...

              rhn-engineering-cdewolf Carlo de Wolf
              jcoffee_jira Guido Bening (Inactive)
              Votes:
              2 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: