Atomikos Forum |
|
Hello everyone, and great job on the library. It has certainly helped us a lot in our project.
Browsing through the source (version 3.6.0), I came accross something that really caught my attention... The connection pool seems to have an interpretation of minPoolSize different from that which is common in other libraries... I would have expected the minPoolSize argument would determine the minimum size of the whole connection pool, however, for what I can see in ConnectionPool.shrinkPool, it's taken to be the minimum number of available connections to keep. If it's set to 20, and there are 5 non-available connections, the pool will be at least 25 connections, not 20... I found this puzzling... it's against the usual aception of minPoolSize, and is actually causing us some issues with MySQL... you will see, MySQL fails with a CommunicationException if it receives a query from a connection that has been inactive for a time longer than a server variable 'wait_timeout' (default to 8 hours). Since Atomikos keeps unused connections above the intended absolute minimum, we find that every day, when the traffic goes up again after the low of the night, all these connections kept alive in the pool though unneeded fail and are destroyed and recreated, but giving an ungly exception to our code for manual reattempts. This could be easily changed by editing line 201 from: int maxConnectionsToRemove = availableSize() - properties.getMinPoolSize(); to int maxConnectionsToRemove = connections.size() - properties.getMinPoolSize(); Is there any reason for this not being the case? Thanks in advace. |