rails/rails — pull request #15585 by kares (2014-06-09 11:21:41+00:00)
Title: an API to allow changing of the connection pool implementation used

I would like to propose a standard way of changing the pool used (e.g. in an initializer) ... sample :

ActiveRecord::ConnectionAdapters::ConnectionHandler.connection_pool_class = Custom::Pool

... no fancy `config.connection_pool_class` API or anything (for now) as I understand this is not something most users will do. the motivation for this is mostly JRuby, there are "highly-concurrent" possibilities that exists (e.g. in Java) to implement a pool in a mostly non-blocking way ... which is very different than AR's default pool guts. we can leverage existing libraries on JRuby to do that. also usually when deploying with JRuby on existing servers there's connection pooling already provided (and configured else-where), the current approach to double "configure" pooling is far from ideal (there's probably more that we'd like to propose in the future in terms of allowing configuring custom pool properties or the class from database.yml but for now I'd like to hear core team's opinions on whether it's approached right). allowing to change the class used would allow (e.g. in AR-JDBC) to setup a custom "false" pool where most of the connection pooling gets delegated to the underlying data source.

I'm open to suggestions (also am not sure about the naming due `ConnectionHandler`'s existing methods)