creating shared pool of connections in metacat servlet
Need changes on MetaCatUtil class to create number of connections on
startup and provide them when needed.
MetaCatUtil can encapsulate the whole process like reading connection
properties, opening connections, storing them in Hashtable with their state:
used or unused and providing them to the callers.
#1 Updated by Matt Jones over 19 years ago
This idea should be generalized to include a shared pool of connections for most
of the important objects like Conneciton, DBReader, DBTransform, and DBQuery.
These objects will need to be thread safe. When a client makes a request, one
of the objects is assigned to that client for the duration of the request, and
then returned to the pool when the request completes. In this way, we avoid the
overhead of creating new objects for every request, but we can still service
multiple requests at a time.
#3 Updated by Jivka Bojilova over 19 years ago
Implemented Pool of Connections only.
DBQuery, DBReader and DBTransform are created on every request.
MetaCatUtil class contains the implementation of the Pool stored in Hashtable.
Every object that needs a Connection for its work gets one from the Pool and
returns it in the Pool when it is done. Initial number of Connections is created
at first, but open a number of new Connections (no more than the maximum
allowed) when Connection object is requested and all Connections in the Pool are
busy at that moment. Before the Connection to be given to the caller check for
existence (implicitly closed) or any problems with the Connection (by quick
setAutoCommit(true) call) and if any it is replaced with new Connection.