I'm currently building a servlet-based web application, which on
initialisation needs to create DB and LDAP connection pools, and initialise
some classes from text files. The connection pools still use the singleton
approach, but also expose initialisation and cleanup methods.
In order to do this I have a servlet which is dedicated to carrying out
these tasks, and provides no other service. The servlet engine is configured
to pre-load the servlet, so as soon as you bring up the service, init() is
called and carries out all the initialisation.
I use the servlet's destroy() method to dispose of the connection pools.
None of the other classes/servlets then need to be concerned with
initialisation.
Hope this helps,
Stephen Baishya
----- Original Message -----
From: Chris Gow <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 11, 1999 4:55 PM
Subject: Servlets and Applications
> Hi:
>
> I was wondering how other developers got around the problem I am now
facing.
> I am about to start working on a project that is going to use Servlets
> extensively, but I am running into a problem in determining the best
> approach to take to allow the Servlets communicate with non-servlet based
> classes (business classes).
>
> For example, a Database Connection pool. Most discussions about this
topic
> involve using a Singleton pattern and just getting a connection from the
> pool when one is necessary. Thats nice and all and is in fact the
approach
> I have taken in all the Servlets that I have developed up to this point.
> But what if you have 5, 10 or more Servlets that need to use the the same
> Connection Pool? Which one is responsible for initializing the pool? All
> of them? If that is the case, that might cause problems when maintaining
the
> system (one class sets the wrong parameter).
>
> My situation is similar to that, except the Objects that my Servlets will
> communicate with are business objects like CustomerCreator,
InvoiceCreator,
> ShipmentCreator, etc...In application development, since I am in control
of
> what gets started when and setting up the communication links between
> Objects and classes, I have never had problems. But with Servlets, I
can't
> think of a similar approach other than the Singleton design pattern.
>
> I was just wondering how developers who have developed larger servlet
based
> applications got their Servlets and their Business Objects to talk to each
> other....
>
> Thank you in advance,
>
>
> Chris Gow
> [EMAIL PROTECTED]
>
>
___________________________________________________________________________
> 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
>
>
___________________________________________________________________________
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