使用HiknateCP和hibernate 5.1.0.Final执行应用程序时遇到问题。在以下日志条目中可以看到连接似乎停留在空闲状态的某个时刻:
2017-08-04 11:13:28 [TreasyPool管家] DEBUG com.zaxxer.hikari.pool.HikariPool - TreasyPool - 池统计数据(总数= 10,活跃= 0,空闲= 10,等待= 0)< / p>
关于在HikariCP中保持连接处于空闲状态所需条件的任何想法?它发生在使用arquillian执行集成测试期间。 persistence.xml包含HikariCP配置参数,如下所示:
<property name="hibernate.current_session_context_class">thread</property>
<!-- Alterado para compatibilidade do hibernate5 -->
<property name="hibernate.id.new_generator_mappings">false</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.use_sql_comments">true</property>
<property name="hibernate.format_sql">false</property>
<!-- Garante que o Envers persista as informaçõesda entidade quando apagado-->
<property name="org.hibernate.envers.store_data_at_delete">true</property>
<!-- Connection Pool with HikariCP -->
<property name="hibernate.connection.provider_class">org.hibernate.hikaricp.internal.HikariCPConnectionProvider</property>
<property name="hibernate.hikari.dataSourceClassName">com.mysql.jdbc.jdbc2.optional.MysqlDataSource</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">virtual#_root$</property>
<property name="hibernate.hikari.dataSource.url">jdbc:mysql://192.168.56.101:2387/prod_test</property>
<property name="hibernate.hikari.maximumPoolSize">30</property>
<property name="hibernate.hikari.minimumIdle">10</property>
<property name="hibernate.hikari.isolateInternalQueries">true</property>
<property name="hibernate.hikari.leakDetectionThreshold">290000</property>
<property name="hibernate.hikari.idleTimeout">10000</property>
<property name="hibernate.hikari.maxLifetime">300000</property>
<property name="hibernate.hikari.autoCommit">false</property>
<property name="hibernate.hikari.poolName">TestPool</property>
<!-- Second-Level Cache -->
<property name="hibernate.cache.provider_class">org.hibernate.cache.internal.NoCachingRegionFactory</property>
<property name="hibernate.cache.use_second_level_cache">false</property>
<property name="hibernate.cache.use_query_cache">false</property>
<property name="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory</property>
<property name="net.sf.ehcache.configurationResourceName">/ehcache.xml</property>
<property name="hibernate.generate_statistics">false</property>
</session-factory>
亲切的问候。