tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Funk <funk...@joedog.org>
Subject Re: Singleton across multiple contexts
Date Mon, 16 Jun 2003 01:15:52 GMT
Place the jar (or class) in common/lib (or common/classes) and all will be 
"ok". That is  - until you need to make a change to your singleton class (or 
a class used by it) - in which case you will need to restart tomcat. (and not 
restart your webapp)

-Tim

Antonio Fiol BonnĂ­n wrote:
> This is the best I could find:
> --------------
> Each application is loaded with sepperate classloaders, so as long as the
> servlets are in the same application and the singleton is in it's classpath
> too it works.
> --------------
> 
> My singleton has to work *across* applications.
> 
> Any ideas?
> 
> 
> Thank you very much.
> 
> 
> Antonio Fiol
> 
> 
> 
> Tim Funk wrote:
> 
>> Look in the archives and search for past Singleton discussions.
>>
>> http://marc.theaimsgroup.com/?l=tomcat-user&w=2&r=1&s=singleton&q=b
>> http://marc.theaimsgroup.com/?l=tomcat-dev&w=2&r=1&s=singleton&q=b
>>
>> Otherwise ...
>> - EJB (???)
>> - Use a custom JNDI Factory (see tomcat jndi docs)
>>
>> -Tim
>>
>> Antonio Fiol BonnĂ­n wrote:
>>
>>> Hello,
>>>
>>> This question is probably not specific to Tomcat, but a 
>>> Tomcat-specific answer could well suit my needs.
>>>
>>> I have an application which I have split in several different 
>>> contexts. I have done so, to allow different kinds of access to the 
>>> app, depending on the web server the requests are coming from.
>>>
>>> However, I need a common unique component that "ties" all the 
>>> contexts together.
>>>
>>> There must be a *single* instance of this component, otherwise 
>>> inconsistencies or duplicate work might arise. OTOH, it must be 
>>> accessible from all the contexts.
>>>
>>> Calls to this component are very simple (calls to void methods) but 
>>> moderately frequent.
>>>
>>> I have thought of several possibilities:
>>>
>>> - Extract the component into a separate JVM, and connect to it via 
>>> socket.
>>> - Extract the component into another context, and connect to it via 
>>> HTTP.
>>> --- I like none of those.
>>>
>>> - Create the instance from the first context needing it, and making 
>>> it available to all of them.
>>> --- I like this best, but I have no idea of how to do that.
>>>
>>>
>>> Yours sincerely,
>>>
>>>
>>> Antonio Fiol
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message