You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Feris Thia <fe...@gmail.com> on 2006/09/08 11:11:10 UTC

Singleton and ServletContext

Dear All,

Is there anyone can point me to any sample how to use singleton object
across web application in Tomcat ?

-- 
Regards,
Feris
PT. Putera Handal Indotama
JL. KH. Moh. Mansyur No. 11 Blok B.8-12
Telp. +62-21-631 6688 (Hunting)
Fax. +62-21-6330211
Jakarta (10140) - INDONESIA

Re: Singleton and ServletContext

Posted by Marc Farrow <ma...@gmail.com>.
Would you not accomplish the same thing by placing it in shared/lib instead
of common/lib?  My understanding is that common/lib is also used by Tomcat
engine itself and also all webapps while the shared/lib is just shared among
all webapps?  Am I mistaken?

On 9/8/06, DJohnson@desknetinc.com <DJ...@desknetinc.com> wrote:
>
> I'll assume you mean shared between separate web applications, as, within
> a single web app. is nothing special.  The key is the classloader.  In
> order for the singleton to be a true singleton, (not one fo reach webapp)
> it must be loaded rom a common classloader.  So the jar it is loaded from
> should probably be in common/lib.  See
> http://tomcat.apache.org/tomcat-4.1-doc/class-loader-howto.html for more
> on Tomcat classloader hierarchy.
>
>
>
> Please respond to "Tomcat Users List" <us...@tomcat.apache.org>
>
> To:     "Tomcat Users List" <us...@tomcat.apache.org>
> cc:
> Subject:        Singleton and ServletContext
>
>
>
> Dear All,
>
> Is there anyone can point me to any sample how to use singleton object
> across web application in Tomcat ?
>
> --
> Regards,
> Feris
> PT. Putera Handal Indotama
> JL. KH. Moh. Mansyur No. 11 Blok B.8-12
> Telp. +62-21-631 6688 (Hunting)
> Fax. +62-21-6330211
> Jakarta (10140) - INDONESIA
>
>
>
>


-- 
Marc Farrow

Re: Singleton and ServletContext

Posted by DJ...@desknetinc.com.
I'll assume you mean shared between separate web applications, as, within 
a single web app. is nothing special.  The key is the classloader.  In 
order for the singleton to be a true singleton, (not one fo reach webapp) 
it must be loaded rom a common classloader.  So the jar it is loaded from 
should probably be in common/lib.  See 
http://tomcat.apache.org/tomcat-4.1-doc/class-loader-howto.html for more 
on Tomcat classloader hierarchy.



Please respond to "Tomcat Users List" <us...@tomcat.apache.org>

To:     "Tomcat Users List" <us...@tomcat.apache.org>
cc:      
Subject:        Singleton and ServletContext



Dear All,

Is there anyone can point me to any sample how to use singleton object
across web application in Tomcat ?

--
Regards,
Feris
PT. Putera Handal Indotama
JL. KH. Moh. Mansyur No. 11 Blok B.8-12
Telp. +62-21-631 6688 (Hunting)
Fax. +62-21-6330211
Jakarta (10140) - INDONESIA