My case is as follow:
I have to maintain a server, with Tomcat(6) as web server, that has a bunch of webapps on it. These webapps are maintained by others. Our server has a connection to another department's DB server, which has information that our webapps need to display. Without proper pooling strategy, our server soon turned to disaster.
Now that I introduce Pooling to everyone (I chose BoneCP - 0.7), we are going to create single pool that stays on Tomcat's global JNDI Context and let everyone get connection from it. That should solve the problem, i guess.
My concern is: How can I fully control this Pooling ? I have some requirements:
I want to reload DataSource configuration at runtime, either manually or programatically (will try to connect to a backup server in the time of need)
Change number of connection (min, max, idle connections) that can change from time to time
Keep Tomcat alive is preferable
I intent to build an alert system that use JMX to connect and retrieve information, and have a button to reload the Pool (I know that all Pooling strategy have some kind of recovering, but the other DB server crash periodically, so restart connections by hand is somewhat preferable).
I think of some possible solutions:
- Tell Tomcat to restart its Global JNDI Context
- Tell Tomcat to restart its DataSource object
- Tell BoneCP to restart its pool, and recreate connections if necessary
- Restart Tomcat itself
My Question are:
- Can I safely perform those above solutions without affect Tomcat (and other webapps) ?
- Should I bother doing this at all ? (Just restart Tomcat, I guess)