1 Reply Latest reply on Nov 5, 2003 2:56 AM by Bernd Zeitler


    nraghuram Newbie

      i need to implement a class as a singleton, accessible in the ejb layer and the web layer (both are part of the same jvm).
      The class caches some lists which are stored in a db and updated rarely. when the update occurs, the updating session bean will remove the invalid list.
      i had a question relating to this :
      will the web layer and the ejb layer see the same instance or are the class loaders different for the jar and war file. as far as i know, it is the same for both in jboss but i wanted to be sure. this is important for me as the servlets and the ejbs access the same singleton class.

        • 1. Re: singleton
          Bernd Zeitler Expert

          Don't do that, since EJB spec say you must not use non final static members and behaviour you get will depend on the container (classloader) implementation.
          Implement this within a MBean, where the web and ejb layer can work with.
          And then you will probable get what you want: both will see the same singleton, since this can be a real singleton at all.