7 Replies Latest reply on Feb 9, 2004 2:32 PM by cari34

    Private attribute in a Stateless Session Bean

    cari34 Newbie

      Hi guys,
      I have a question about the design of a stateless session EJB.
      I would like to know :

      Does it make sense to put a private field in a stateless session bean???

      Imagine the following sitiation:
      I have a stateless session bean deployed on JBOSS.
      Its job is to delegate the clients calls to some services (Java objects).
      So I would like these services (Java objects) be instantiated before the clients invoke the bean's method for delegation - I mean, when JBOSS
      decides to create beans and put it in the pool (on the server startup for example).

      But what happens when the same bean once having finished its job is used by a different client???

      Are the services once instatiated available to the new client or JBOSS invokes the ejbCreate() method and the services are instatiated one more time???(which would be a performence killer)

      I must mention that in order to make the instatiation of the services possible, I presume I must implement the ejbCreate() method on the bean implementation class which invokes a private method doing the instatiation.

      So, do you think these design is a good design and what is its impact on the performence of the stateless session EJB in JBOSS???

      Thank you.