thank you Craig. I must say my question was a bit provocate,
we are using our own session/connection stuff a long time ago
(as soon as we faced implementation bugs in the different servlets
engines), but I think your long letter contains a pretty good
explanation for all alternatives.


P.S. Except some remarks about O-O style, but that so flame ready
topic and it would be better for me do not touch this at all :-)

>Sure, you can create a connection pool object dynamically using
>Class.forName()
>   or whatever.
>   The singleton pattern (using a static method) can work, as long as you
>only ever
>   need one
>   connection pool. But, what happens when you need TWO of them? (And it
>might
>   not be you that
>   needs the second -- it might be another application running in the >same
servlet
>   engine as
>   you)

>   OPTION 1 -- If you use the "static method" approach like this:

>   public class ConnectionPool {
>
>   public static Connection getConnection() { ... }
>
>   ....

>   }

   then you've got a singleton pattern implementation, and you can't have two
   different ones
   (unless you try to embed that logic in your singleton connection pool,
which
   doesn't seem

ColdJava: java server side programming
http://coldjava.hypermart.net

____________________________________________________________________
Get your own FREE, personal Netscape WebMail account today at 
http://webmail.netscape.com.

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to