tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Jackson" <mjack...@cdi-hq.com>
Subject RE: about singletons (ot)
Date Wed, 29 Jan 2003 00:14:08 GMT
Me too, we learn by doing... :)

That's also the reason that I follow the pattern as it is stated now, rather
than thinking I can make it a little different.

--mikej
-=-----
mike jackson
mjackson@cdi-hq.com

> -----Original Message-----
> From: Larry Meadors [mailto:Larry.Meadors@plumcreek.com]
> Sent: Tuesday, January 28, 2003 4:09 PM
> To: tomcat-user@jakarta.apache.org
> Subject: RE: about singletons (ot)
>
>
> I would agree.
>
> We had a static class and we thought it would work great...it turned out
> that we ended up rewriting much of it to use the getInstance() type of
> interface - it is just so much more flexible if you *EVER* need to
> change stuff.
>
> Larry
>
> >>> mjackson@cdi-hq.com 01/28/03 16:08 PM >>>
> The difference is that if you use a singleton there's one instance.  If
> everything
> is static then you only have one copy.  Usually when you use a singleton
> it's to
> control access to some resource, the intent is that you use the
> singleton
> and some
> synchronized calls (note I don't mean synchronized methods, but
> synchronized
> code
> blocks) to control threads using that resource.  You could probably
> implement
> a similiar system if everything were static, but I wouldn't want to try
> (it's more
> work than you think).
>
> --mikej
> -=-----
> mike jackson
> mjackson@cdi-hq.com
>
> > -----Original Message-----
> > From: Felipe Schnack [mailto:felipes@ritterdosreis.br]
> > Sent: Tuesday, January 28, 2003 1:56 PM
> > To: Tomcat Users List
> > Subject: about singletons (ot)
> >
> >
> >   These days I was thinking
> >   It's not so uncommon to have uses for singleton classes in our
> > everyday lives. Normally we do that implementing a class that have its
> > constructor as private, so no one can instantiate it, and a
> > getInstance() method or something like it. We wouldn't have the same
> > kind of behavior if we simply declare all class methods/fields as
> > static?
> >
> > --
> >
> > 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:
> > <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:tomcat-user-help@jakarta.apache.org>
> >
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto: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


Mime
View raw message