<bean id="hikariConfig" class="com.zaxxer.hikari.HikariConfig">
<property name="poolName" value="springHikariCP" />
<property name="maximumPoolSize" value="100" />
<property name="jdbcUrl" value="${tomcat.jdbc.url}"/>
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="username" value="${tomcat.jdbc.username}"/>
<property name="password" value="${tomcat.jdbc.password}"/>
<property name="idleTimeout" value="600000"/>
<property name="maxLifetime" value="1800000"/>
<property name="dataSourceProperties">
<props>
<prop key="cachePrepStmts">true</prop>
<prop key="prepStmtCacheSize">250</prop>
<prop key="prepStmtCacheSqlLimit">2048</prop>
<prop key="useServerPrepStmts">true</prop>
<prop key="useLocalSessionState">true</prop>
<prop key="useLocalTransactionState">true</prop>
<prop key="rewriteBatchedStatements">true</prop>
<prop key="cacheResultSetMetadata">true</prop>
<prop key="cacheServerConfiguration">true</prop>
<prop key="elideSetAutoCommits">true</prop>
<prop key="maintainTimeStats">false</prop>
</props>
</property>
</bean>
<bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close"> <constructor-arg ref="hikariConfig" /> </bean>
It works fine but I noticed that when the application session is expired (session-timeout by web.xml) or invalidated by explicit logout, the connections remain active so their number is increasing. And hikaricp
doesn't close that connection used by application even after the maxLifetime time.
03/11 16:34:20.312 DEBUG [springHikariCP connection closer][PoolBase] springHikariCP - Closing connection com.mysql.jdbc.JDBC4Connection@4bf3cc97: (connection has passed maxLifetime)
Am I missing something?
How do I change my code or configuration?
Thanks in advance
Cheers
Matteo