How I can use FlexyPool with HikariCPFactory?

白昼怎懂夜的黑 提交于 2020-01-24 09:00:52

问题


I want measure metrics on my datasource comparing HikariCP and C3pO. I don’t understand how I can use FlexyPool in my project. I have Tomcat context.xml and HikariCP:

          <Resource name="jdbc/dictionaryDB"
            auth="Container"
            factory="com.zaxxer.hikari.HikariJNDIFactory"
            type="javax.sql.DataSource"
            driverClassName="org.postgresql.Driver"
            jdbcUrl="jdbc:postgresql://localhost:5432/deversdb"
            username="user"
            password="pass"
            maxActive="8"
            maxIdle="4"/>

Please help me, i’am very newbie in connection pooling theme. What I must to do with this https://github.com/vladmihalcea/flexy-pool/wiki/HikariCP-Configuration ?


回答1:


Since you already have a DataSource that is provided via JNDI, you could try to use the Java EE installation mode.

For this, you need a flexy-pool.properties configuration file on your classpath root, which must contain the following properties:

flexy.pool.data.source.unique.name=some-unique-name
flexy.pool.data.source.jndi.name=jdbc/dictionaryDB
flexy.pool.metrics.reporter.jmx.auto.start=true

As dependencies, you need:

<dependency>
    <groupId>com.vladmihalcea.flexy-pool</groupId>
    <artifactId>flexy-java-ee</artifactId>
    <version>${flexy-pool.version}</version>
</dependency>


来源:https://stackoverflow.com/questions/38611056/how-i-can-use-flexypool-with-hikaricpfactory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!