##Overview
This is a moderately simple implementation of a connection pool using the opower scaffold.
It implements com.opower.ConnectionPool
and provides some bonus features.
The Tidal Connection Pool includes a ConnectionPoolConfig
class for setting various aspects of the pool.
The conection pool class itself is co.txrx.tidal.ConnectionPool
.
The pool is limited to the "get and release" model, and does not use the event based models
in newer JDBC implementations. Therefore, the programmer must remember to always release
their connections via the connection pool releaseConnection(Connection connection)
method.
The pool itself does not have any new dependancies. The tests require JUnit,
h2 and mysql-connector-java maven packages.
If you wish to use Tidal Cp you must first:
import co.txrx.tidal.ConnectionPool;
Then create the configuration:
ConnectionPoolConfig config = new ConnectionPoolConfig();
config.setDataSourceUrl("jdbc:<someurl>");
config.setUser("someuser");
config.setPassword("somepassword");
Create the connection pool and use it:
ConnectionPool tidalCp = new ConnectionPool(config);
Connection conn = tidalCp.getConnection();
// Do stuff with conn...
tidalCp.releaseConnection(conn);
Finally, either shutdown the pool to allow active connections to finish on their own terms:
tidalCp.shutdown();
Or, destroy them with violence:
tidalCp.terminate();
That's most of it. The config class has options to play with that determine the init and max idle connections and max total connections.