Using the Hikari Connection Pool (HikariCP)
In this recipe, you will learn how to set up and use the high-performance HikariCP.
Getting ready
The HikariCP framework was created by Brett Wooldridge, who lives in Japan. Hikari in Japanese means light. It is a lightweight and relatively small API that is highly optimized and allows for tuning via many properties, some of which are not available in other pools. In addition to standard user, password, maximum pool size, various timeout settings, and cache configuration properties, it also exposes such properties as allowPoolSuspension
, connectionInitSql
, connectionTestQuery
, and many others, even including a property that deals with the not-timely-closed connections, leakDetectionThreshold
.
Â
To use the latest (at the time of writing this book) version of Hikari pool, add the following dependency to the project:
<dependency> <groupId>com.zaxxer</groupId> <artifactId>HikariCP</artifactId> <version>3.2...