On Thu, 5 Jun 2003, Brian Kidney wrote:
> Date: Thu, 5 Jun 2003 14:26:19 -0230 > From: Brian Kidney <[EMAIL PROTECTED]> > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] > To: [EMAIL PROTECTED] > Subject: Singletons in Tomcat > > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > If I have a class in my application which is a singleton, is there only > one object per server (Tomcat in my case), or is it unique to the > session (ie. each user gets a different instance)? > In all scenarios, a singleton implemented (say) as a static variable will be a singleton for an entire webapp, and therefore a singleton instance will be shared among all users. However, if you have multiple webapps sharing the defining class (because you put the class in common/lib or shared/lib for Tomcat), there will be one instance for the entire servlet container, across webapps, as well. The precise details of whether this is actually true or not, of course, depend on how you implemented the "singleton-ness" of the variable in question. You would need to provide more details on how you implemented this to ensure that your objectives are being met. > Brian Craig --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]