3 Replies Latest reply on Nov 4, 2002 4:23 AM by thomasra

    where can i encaptulate the global parameter?

    zhebincong

      hello
      consider my scenario,when i develop project in web tier,i can write a singleton to encaptualte the global parameter,such as jndi look up......,and write a servlet (config it as "load on startup")to instantiate the singleton as soon as the web container is started up,then other classes in the web tier can get the global parameter by using the static get method of the singleton,i think maybe it is so-called "service locator pattern",it works well.

      but now,i want to extend such mechanism to ejb tier,that is i also write a singleton to encaptulate the global patameter within the ejb tier,this singleton can be started up automatically by something(in web tier,i can use serlvet to take the responsibility,but i can't find such a thing in the ejb tier) as soon as the ejb container is started up,it is only my guess,i don't know if it is realizable,and the following question confuse me:
      1 if the ejb container support singleton object,that is if the session bean can visit the singleton in ejb container just as java bean visit the singleton in servlet container?

      2 if my suggestion is available,who can take the role to start up the singleton in ejb container just as the servlet in web container takes?
      thanks for any instruction!