At 09:58 PM 4/10/02 -0400, you wrote:
>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.

that sounds like a good way to solve the problem with different nodes.

>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.

it looks like a different class loader is used (or different jvm's - i am 
on a linux box so i see many processes (but they are really threads of one 
parent process, so i am guessing one jvm and multiple class loaders)).

is there some way to make tomcat use the same class loader?

thanks

>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. ...
>...

---
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]>

Reply via email to