Hi!
I am implementing a custom pool for handing out and maintaining a pool of
connections.
I want to make a pool that is global and each servlet can draw connections
and return to it.
I have tested 3 different implementations for it. Though all are working
just fine I want your opinion for what could be the best.
Base:
A class that extends the DbConnectionBroker class:
1. Makes a static ref to DbConnectionBroker and in its static block inits.
the variable.
2. Also provides a blank cons which fires the default constructer of its
super class.
So far so good.
Implementations:
Approach 1:
Have any servlet from its doXXX() call
MyDbConnectionBroker.pool.getConnection(). The first servlet to do this
inits. the class. All subsequent servlets can just draw from the pool as
aforesaid.
Approach 2:
Only one servlet ( that starts the db intensive part) calls the following
code from its init():
Class.forName(pack.MyDbConnectionBroker).newInstance();
But this loads the servlet using the custom class loader that is used to
load the servlet.
All subsequent servlets can call MyDbConnectionBroker.pool.--- for all
methods.
Approach 3:
Implement this code( of app. 2)  in a servlet and place the servlet in the
jws/classes dir so that it gets the benefit of the System class loader at
server startup. Loading the servlet loads the MyDbCon--- also so all
subsequent ref. are fast.
Thanks,
Vivake.



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.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