2 Replies Latest reply on Jan 19, 2006 9:02 AM by vinay076

    Stateless Session Bean Instances - How to limit them ?

    vinay076

      Hi
      We have few stateless session beans. Whenever a user accesses these beans an instance is created. It starts from 1 and keeps on increasing even beyond the count mentioned in standardjboss.xml under tag
      <container-pool-conf>
      50
      true
      </container-pool-conf>
      I have even tried using but to no avail. Because of this we are having thousands on EJB instances on server which is consuming a lot of memory.
      Any solutions please.

        • 1. Re: Stateless Session Bean Instances - How to limit them ?
          dimitris

          Can you provide a minimal testcase that replicates this behaviour? Thanks.

          • 2. Re: Stateless Session Bean Instances - How to limit them ?
            vinay076

            I actually don't have a test case but we have deployed the application on Production and then found the problem.
            Currently I am running this scenario in test system
            1. I am clicking on a hypelrink to view some details
            2. These details are fetched through a method in EJB (Local)
            3. User changes and presses save
            4. Update functionality in same EJB is called(local)

            When I view from Jmx-console of Jboss , i find CreateCount of this ejb has increased by 2. Is this the no of instances in container or its just the call stats? I am assuming it to be no of instance.
            Now this EJB's local home is also cached

            Map cache = Collections.synchronizedMap(new HashMap());

            public EJBLocalHome getLocalHome(String jndiHomeName)
            if (cache.containsKey(jndiHomeName)) {
            home = (EJBLocalHome) cache.get(jndiHomeName);
            } else {
            home = (EJBLocalHome) ic.lookup(jndiHomeName);
            cache.put(jndiHomeName, home);

            But surprisingly everytime it creates new instance