On 8/3/2012 12:58 PM, Bernd Prager wrote:
>
> void Dal::putConnection(boost::any connection) {
> if((int)connectionPool.size() == connectionPoolMax) {
> // pool is full
> boost::lock_guard<boost::mutex> lock(mutex);
> destroyConnection(connection);
> }
> connectionPool.push_back(connection);
> }
Explain to me how this doesn't insert destroyed connections into the
pool when you hit the pool's size limit.
Another likely problem is that this looks like it will create value
copies of the Connection objects, which causes MySQL DB server
re-connection. You'd do better here to use reference semantics.