@FunctionalInterface
public interface HikariPoolMapping
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getKey(HostSpec hostSpec,
java.util.Properties originalProps)
A function that can optionally be passed to the
HikariPooledConnectionProvider
constructor to define a mapping from the given parameters to an internal connection pool key. |
java.lang.String getKey(HostSpec hostSpec, java.util.Properties originalProps)
HikariPooledConnectionProvider
constructor to define a mapping from the given parameters to an internal connection pool key.
By default, the HikariPooledConnectionProvider will create an internal connection pool for
each
database instance in the database cluster. This function allows you to define your own key
mapping if the default behavior does not suit your needs. For example, if your application
establishes multiple connections to the same instance under different users, you can implement
this function to return a key that incorporates the HostSpec URL and the user specified
in the properties. The resulting HikariPooledConnectionProvider will then create a new internal
connection pool for each instance-user combination.
hostSpec - the host details for the internal connection pooloriginalProps - the properties specified for the original connection through
DriverManager.getConnection(String, Properties)