2 Replies Latest reply on Jan 11, 2002 2:26 AM by vincent

    Disabled Entity Instance Pool

      I posted a message about this last week but it seems to have gotten lost in the move to the new forum format since it doesn't come up in my watch list and I can't find it anywhere else...

      Anyway, it seems that entity bean instances are not cached in JBoss 2.4.x, where x>=1.

      Demonstrating that entity bean instances are not cached is fairly straightforward:
      1. Add a System.out.println() to an entity bean's constructor.
      2. Reduce the max pool size for an entity bean in standardjboss.xml to some small value (I reduced it for Standard BMP Entity Beans).
      3. Write a test client that loops through more beans than the max pool size specified in standardjboss.xml.

      When this is done, the bean constructor is repeatedly called indicating that the bean instances are not pooled but discarded. If the same test is done with 2.4.0, the constructor is called one more time than the max pool size and that's it (I'm not sure what the extra instance is for).

      I did some poking around in the code and discovered that org.jboss.ejb.plugins.EntityInstancePool has been modified so that entity instances are now discarded by default rather than pooled. It looks like enabling pooling requires using different interceptors in standardjboss.xml. In particular EntityMultiInstanceInterceptor and EntityMultiInstanceSynchronizationInterceptor rather than EntityInstanceInterceptor and EntitySynchronizationInterceptor (all in package org.jboss.ejb.plugins). However, using these interceptors does not seem to have any effect. My bean constructors are still repeatedly called.

      One of the features of the EJB architecture seems to be instance pooling so I'm wondering why this was disabled and how I can turn it back on. Am I missing something?

      Thanks,
      Dan Ciarniello