jon * wrote:
> 
> on 1/27/00 12:52 AM, David Warnock <[EMAIL PROTECTED]> wrote:
> 
> > I do take your point about dynamically running services and I also have
> > read Jon's message that services are not supposed to be singletons.  If
> > singleton services are not supported then I agree with the -1, otherwise
> > I guess we can use the actual service as a proxy onto a singleton that
> > does the real work.
> 
> No, you don't understand the point of having Services. The services
> themselves should not be singletons, the TurbineServices object IS a
> singleton...it brokers out other objects that need to act like services.
> 
> The reason for creating Services API is that what is happening is that we
> are creating many many many singleton's by copying and pasting a similar
> chunk of code over and over again to create singletons...
> 
>     public static TurbineServices getInstance() {
>         if (instance == null) {
>             synchronized (TurbineServices.class) {
>                 if (instance == null) {
>                     instance = new TurbineServices();
>                     services = new Hashtable(5);
>                 }
>             }
>         }
>         return instance;
>     }
> 
> There are two way to effectively create a Singleton. The first way is with
> the above piece of code, that in my opinion is a true singleton. The second
> way is to simply hold on to a reference to an object within a singleton. So,
> lets have a simple Singleton who's job it is to load services (this is the
> TurbineServices object) and hold those services within a hashtable
> (effectively holding on to a reference of an instance of an object).
> 
> I could see re-doing all the module/*Loaders to be Services as well since
> they are essentially just TurbineServices objects as well.
> 
> Brett's suggestions are simply a clarification of what is already there. His
> proposals simply fix the issues with casting that we are starting to run
> into.
> 
> > I do feel myself that singletons are very handy in services for the same
> > reasons that servlets run better as singletons with multiple threads.
> 
> Right, but a servlet isn't really a singleton. It is simply the second way
> (that I described above) for effectively creating the same thing as a
> singleton. Essentially, a Service is just the equivalent of a simple servlet
> engine.

+1 for Jon letting me avoid answering questions on my proposals!!! ;-)

-Brett

> 
> -jon
> 
> --
> Come to the first official Apache Software Foundation
> Conference!  <http://ApacheCon.Com/>
> 
> ------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Problems?:           [EMAIL PROTECTED]


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to