2 Replies Latest reply on Nov 23, 2006 12:46 AM by srki

    singleton ejb, loading classes from config.xml file?

    srki

      Hello,

      I have a question regarding design in EJB.

      Should I use a singleton in my MDB or in stateless session beans. I have a servlet that calls a stateless session bean that calls a message driven bean. In the message driven bean constructor I call a singleton to set the mdb class variable. This singleton class reads the configuration file and initializes some framework classes.

      Is this ok to do initialization of classes from a configuration files and thus have singletons? In this configuration file I basically have something like a map between the xml message tab and the request class for that message and well as the action processor

      Thanks,

        • 1. Re: singleton ejb, loading classes from config.xml file?
          srki

          Another question I would like to know is when the container could give another instance of stateless session bean to a client from the pool. Meaning if I have a stateless session bean with only a foo() method that is called by the client. If that foo method has references to other plain java objects. Can those plain java objects that are created in method foo have member variables ( with state ) which are forbidden in stateless session beans. I assume yes but I would like just to make sure.

          Thanks

          • 2. Re: singleton ejb, loading classes from config.xml file?
            srki

            Please ignore my second post.