如何在HikariCPFactory中使用FlexyPool? [英] How I can use FlexyPool with HikariCPFactory?

查看:229
本文介绍了如何在HikariCPFactory中使用FlexyPool?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想比较HikariCP和C3pO在我的数据源上度量指标。
我不了解如何在项目中使用FlexyPool。
我有Tomcat context.xml和HikariCP:

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"/>

请帮助我,我是连接池主题的新手。我必须对此 https://github.com/vladmihalcea/flexy-池/ wiki / HikariCP配置吗?

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 ?

推荐答案

因为您已经有 DataSource 通过JNDI提供,您可以尝试使用 Java EE安装模式

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

为此,您需要配置 flexy-pool.properties 文件放在类路径根目录下,该文件必须包含以下属性:

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

作为依赖项,您需要:

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

这篇关于如何在HikariCPFactory中使用FlexyPool?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆