tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felipe Schnack <feli...@ritterdosreis.br>
Subject Re: Loading Singleton Classes
Date Thu, 20 Feb 2003 20:44:15 GMT
  Or even
  public static final Singleton s = new Singleton();
  :-)

On Thu, 2003-02-20 at 17:43, Tim Funk wrote:
> Actually you'll want to make
>    public static Singleton s = new Singleton();
> be
>    private static Singleton s = new Singleton();
> 
> So a wise guy doesn't do this:
>     Singleton.s = null;
> 
> -Tim
> 
> Mike Jackson wrote:
> > To code it correctly follow the pattern.  :)
> > 
> > 
> > Should look something like this:
> > 
> > 	class Singleton {
> > 		public static Singleton s = new Singleton();
> > 
> > 		protected Singleton() {
> > 			super();
> > 		}
> > 		public static Singleton getHandle() { 
> > 			return s;
> > 		}
> > 	}
> > 
> > --mikej
> > -=-----
> > mike jackson
> > mjackson@cdi-hq.com 
> > 
> > 
> >>-----Original Message-----
> >>From: Luc Foisy [mailto:Luc.Foisy@technical-magic.com]
> >>Sent: Thursday, February 20, 2003 11:35 AM
> >>To: Tomcat Users List
> >>Subject: RE: Loading Singleton Classes
> >>
> >>
> >>Ok. How do I code it incorrectly then? :)
> >>I want it to be unique to each session. Is there anyway I can do that?
> >>
> >>
> >>>-----Original Message-----
> >>>From: Mike Jackson [mailto:mjackson@cdi-hq.com]
> >>>Sent: Thursday, February 20, 2003 2:31 PM
> >>>To: Tomcat Users List
> >>>Subject: RE: Loading Singleton Classes
> >>>
> >>>
> >>>Same, if you code it correctly.
> >>>
> >>>--mikej
> >>>-=-----
> >>>mike jackson
> >>>mjackson@cdi-hq.com 
> >>>
> >>>
> >>>>-----Original Message-----
> >>>>From: Luc Foisy [mailto:Luc.Foisy@technical-magic.com]
> >>>>Sent: Thursday, February 20, 2003 11:26 AM
> >>>>To: Tomcat Users List
> >>>>Subject: RE: Loading Singleton Classes
> >>>>
> >>>>
> >>>>Hmmm
> >>>>
> >>>>My jar is located in web-inf/lib
> >>>>
> >>>>Perhaps I should rephrase that question.
> >>>>When I load the singleton class, will it be the same singleton 
> >>>>called from all sessions or will it be unique to each session?
> >>>>
> >>>>
> >>>>>-----Original Message-----
> >>>>>From: Filip Hanik [mailto:Filip.Hanik@evant.com]
> >>>>>Sent: Thursday, February 20, 2003 2:15 PM
> >>>>>To: Tomcat Users List
> >>>>>Subject: RE: Loading Singleton Classes
> >>>>>
> >>>>>
> >>>>>it doesn't become a variable at all.
> >>>>>
> >>>>>but to answer your question, if you load a singleton class it 
> >>>>>all depends on where the class is in the classloader hierarchy.
> >>>>>
> >>>>>if you put the class in a jar in common/lib, the singleton 
> >>>>>will be for your entire tomcat server. if you put it in a jar 
> >>>>>in web-inf/lib it becomes a singleton class for your webapp only.
> >>>>>
> >>>>>Filip
> >>>>>
> >>>>>-----Original Message-----
> >>>>>From: Luc Foisy [mailto:Luc.Foisy@technical-magic.com]
> >>>>>Sent: Thursday, February 20, 2003 11:14 AM
> >>>>>To: Tomcat User List (E-mail)
> >>>>>Subject: Loading Singleton Classes
> >>>>>
> >>>>>
> >>>>>
> >>>>>If I load a singleton class, does it become a session 
> >>>>>variable or an application variable????
> >>>>>
> >>>>>
> >>>
> >>>---------------------------------------------------------------------
> >>>
> >>>>>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
> >>>
> >>>>>
> >>>>
> >>>---------------------------------------------------------------------
> >>>
> >>>>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
> >>>
> >>>
> >>
> >>---------------------------------------------------------------------
> >>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
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
-- 

Felipe Schnack
Analista de Sistemas
felipes@ritterdosreis.br
Cel.: (51)91287530
Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter@ritterdosreis.br
Fone/Fax.: (51)32303341


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