2 Replies Latest reply on Nov 16, 2004 10:50 AM by fredatwork

    Removing stateless session beans

    fredatwork

      Hello,

      I'm relatively new to EJBs and I have a question on stateless session beans.

      I would like to know if I need to remove stateless session beans once I'm finished using them.

      I understand that my J2EE server (JBoss in this case) has a reserve of bean instances ready to execution business methods.

      Let's say I create a HelloWorld stateless session bean and call a helloWorld() method on it (the business method). Once the method returns, do I need to remove programatically the session bean in order to make sure that the stateless session bean returns to the server reserve of beans ? I would like to make sure my code does not leave "leftover" that would threaten the availability of server resources (session beans in this case).

      Thanks in advance for your help.

      Fred

        • 1. Re: Removing stateless session beans
          darranl

          Your client is not associated with a stateless session bean, calling remove has no effect on a specific session bean instance.

          Immediately after the call to helloWorld the bean instance will have been returned to the pool ready to service other clients.

          • 2. Re: Removing stateless session beans
            fredatwork

            Thanks to Darran for his tip.

            I understand the life cycle of a stateless session bean better and that the create() method (invoked on the home of a stateless session bean) does not call the ejbCreate method.