[of static methods and singletons]

> Static methods are ok. But static data such as singletons cause many
> questions in the list (a quick 30 second search turned these up):

> I'm not saying there bad - in some cases they work great. But they can be
> very confusing for others, which I why I try to avoid it. Static by itself is
> tricky for some to comprehend.

Oh, I see what you mean.  Tomcat's use of multiple classloaders does
present you with somewhat of a qualified notion of what a singleton
is.

If the class lives in CATALINA_BASE/shared, you get a `real' Singleton
where one instance is used by all contexts; if you put the class in a
context's WEB-INF, then you have a singleton that is only accessible
to that context; if you put the class in the WEB-INFs of two different
contexts, then you get two different instances of the Singleton class.


Anyway, thanks for the discussion :)

-- 
Steve

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to