tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Rudnicki <>
Subject Re: Singleton Revisited
Date Fri, 18 Aug 2000 06:42:14 GMT
> For sharing information *within* a web app, the singleton pattern
> as a static variable is feasible and portable (although I dislike it for
> "personal bias" reasons -- I've seen too many apps get messed up because
> code in the entire application can mess with those global variables,
> bugs hard to track down).

Good, I thought that there would be only one classloader per webapp.  So all
is well unless some decides to load balance for you and install the webapp
on multiple machines.  Then the singleton would break again.
What globals?  My singletons don't have any globals.

Does a delegation model classloader break this?  Or, as long as the
singleton is only one place (web-ing/classes) then the same loader will be
used for the same webapp every time?

> For sharing information *across* web apps, the
> servlet spec advises using external mechanisms (files, databases,
> servers, etc.) to maintain portability.

Okay, right, each webapp has a separate classloader.  But, this is good.
You should not be able to share anything between webapps for security.


View raw message