You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 23, 2018. It is now read-only.
I plugged your pool into the HikariCP benchmark harness because I was curious how DBPool performed. The benchmark uses Oracle's JMH benchmarking framework, and the primary connection test simply performs DataSource.getConnection() then connection.close() in multiple threads, as fast as possible.
Unfortunately, DBPool blows-up within the first few milliseconds. Because the open and closing members of CacheConnection are not volatile there are quickly cross-thread visibility issues (exceptions) that cause the connection to be declared invalid almost immediately and ejected from the pool.
I note also the complete lack of unit tests for this library, which should have quickly uncovered this issue. Applications that are using DBPool are either not under significant load or are "getting lucky" by crossing a Java memory barrier that happens to flush the CPU cache-lines before cross-thread visibility issues arise.