I created a ConnectionPool for a Tomcat web application and it works great. I used the Singleton pattern. It measurably improved the performance of the application. But in our enterprise, we have several environments (test-dev-production) where we connect to different databases. Is there a way of making one ConnectionPool class that could serve different databases or named connection pools? It seems with the Singleton pattern, you'd have to create a separate connection pool class for each connection pool you have configured. I hope this makes sense.
If you write your own, then yes - you would need multiple logical classes. Which could be one class with configurable parameters. For example if you call MyConnectionPool.getInstance("test") or MyConnectionPool.getInstance("prod"), it would return a singleton for that parameter. MyConnectionPool would store a map of keys to logical singletons.