Try RMI.  You cannot have an instance of a class shared across multiple 
JVMs (= multiple instances of Tomcat running).  But you might be able to 
set up an RMI server with a singleton instance of a Remote object.

Sharing across different contexts within the same Tomcat engine is a 
different matter.  That ought to work as long as the class is loaded by 
the same ClassLoader instance used by each context to load classes.  How 
to control that is beyond me.

jeff

Ray Tayek wrote:

> hi, i need to have a global singleton that is a singleton across all 
> instances of (tomcat) servlet engines.
> 
> is there an engine context in tomcat that i can access?
> 
> does this singleton work across virtual hosts?
> 
> how does this work across multple jvm's on the same machine (or does 
> this not happen)?
> 
> how about when you are load balancing across different physical nodes? - 
> do you need to have some system semaphore on one of the nodes to prevent 
> multiple instances?
> 
> afaict so far, restarting a context, takes down all of the classes in 
> the context and putting copy of singleton into a different context, 
> seems to cause two instances to be created.
> 
> any pointers would be appreciated.
> 
> thanks
> 
> ---
> ray tayek http://home.attbi.com/~rtayek/
> actively seeking telecommuting work
> vice chair orange county java users group http://www.ocjug.org/ 
> mailto:[EMAIL PROTECTED]
> hate spam? http://samspade.org/ssw/
> 
> 
> -- 
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
> 
> 
> 


-- 
Jeffrey Bonevich
Ann Arbor, Michigan
[EMAIL PROTECTED]
http://www.bonevich.com

Hwæt! Wë Gär-Dena   in geär-dagum,
peod-cyninga,       prym gefrünon,
hü ða aepelingas   ellen fremedon!


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to