I have a simple framework you can download from
http://www.brainopolis.com/jsp/mvc/KDuffey_MVC.html

It is free to use, free source. I am not sure if what your saying about
Singleton is correct however. If you have a single controller servlet that
implements the Singleton interface, your telling the serlvet engine to allow
only ONE thread at a time to run. Yes, its one instance, but the Singleton
interface is a market to let the server know that you only want one thread
at a time running. An servlet engine does one of two things. It either
creates a pool of these classes, to handle multiple threads. Or it que's the
incoming requests, and waits for each thread to be done before another
request can execute.

The general consensus that I have read in books is the Singleton way of life
is a bad move for scalability reasons. If your site is flodded with 1000
requests at the same moment, the last requests coming in will see a definite
slow response..ofcourse depending on hardware as well. If the servlet engine
does pool instances, it is still slower than not using the Singleton
interface and simply allowing the servlet engine to allow multiple threads
to do their thing. The problem to keep in mind is that servlets (and in my
framework action classes) are not allowed to have any instance fields,
otherwise multiple threads end up "sharing" those instance fields in a
servlet or action class. As long as you program in this manner, your safe,
and you end up with a faster more scalable solution. My framework creates a
single ActionContext object for each request, which is used to pass around
to any and all methods inside the action class.

At any rate, feel free to throw some questions my way. I am happy to help if
I can.


> -----Original Message-----
> From: Gerry Scheetz [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 23, 2001 7:26 AM
> To: [EMAIL PROTECTED]
> Subject: MVC and Database Connection Pool
>
>
> I am developing a database application and am using a similar
> MVC design to that in a couple books I have. In those books
> they have a singleton class (a class in which there will only
> ever be one instance) that accesses the database to create
> JavaBeans, which are used to populate the JSP pages. These
> singleton classes also are used to update the database with
> information from those JavaBeans.
>
> Now I am assuming you have more that one of these singleton
> classes in larger systems. Example, I am working on a billing
> inquiry system. So I have one singleton class for the
> CustomerBean and a different singleton class for the Invoice
> Bean. (I could be wrong in this assumption and there lies my problem.)
>
> I would also like to use Database Connection Pooling. I would
> like to have one collection of connections that are used by
> all the singleton classes. I would also like to hide the fact
> that I am using a database to every classes except the
> singleton classes. Right now I can not figure out how to use
> one common collection without defining it in my
> Controller/Servlet class and then instantiating all my
> singleton classes and telling them about the connection pool.
>
> So what I am looking for is examples of class organizations
> of people using MVC and database connection pools. Also would
> be interested in other online examples or e-mail lists where
> I could get an answer to my question.
>
> TIA,
>
> Gerry Scheetz
> Web Application Development
> Global Information Technology Division
> TRW - S&ITG
> Helena, Montana, USA
> [EMAIL PROTECTED]
> (406) 594-1878
>
> ==============================================================
> =============
> To unsubscribe: mailto [EMAIL PROTECTED] with body:
> "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set
> JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to