proxool.xml文件 详解

<?xml version="1.0" encoding="ISO-8859-1"?>  
<!--  
Properties for Proxool Configurator testing. Defines the same parameters as  
TestHelper.buildCompleteAlternativeProperties()  
-->  
<something-else-entirely xmlns="http://sumthin.else.entirely" xmlns:proxool="The latest version is available athttp://proxool.sourceforge.net/xml-namespace">  
    <proxool:proxool>  
        <proxool:alias>xml-test-ns</proxool:alias>  
        <proxool:driver-url>jdbc:hsqldb:db/test</proxool:driver-url>  
        <proxool:driver-class>org.hsqldb.jdbcDriver</proxool:driver-class>  
        <proxool:driver-properties>  
            <proxool:property name="user" value="sa"/>  
            <proxool:property name="password" value=""/>  
        </proxool:driver-properties>  
        <proxool:house-keeping-sleep-time>40000</proxool:house-keeping-sleep-time>  
        <proxool:house-keeping-test-sql>select CURRENT_DATE</proxool:house-keeping-test-sql>  
        <proxool:maximum-connection-count>10</proxool:maximum-connection-count>  
        <proxool:minimum-connection-count>3</proxool:minimum-connection-count>  
        <proxool:maximum-connection-lifetime>18000000</proxool:maximum-connection-lifetime> <!-- 5 hours -->  
        <proxool:simultaneous-build-throttle>5</proxool:simultaneous-build-throttle>  
        <proxool:recently-started-threshold>40000</proxool:recently-started-threshold>  
        <proxool:overload-without-refusal-lifetime>50000</proxool:overload-without-refusal-lifetime>  
        <proxool:maximum-active-time>60000</proxool:maximum-active-time>  
        <proxool:verbose>true</proxool:verbose>  
        <proxool:trace>true</proxool:trace>  
        <proxool:fatal-sql-exception>Fatal error</proxool:fatal-sql-exception>  
        <proxool:prototype-count>2</proxool:prototype-count>  
    </proxool:proxool>  
    <nothing-to-do-with-proxool>  
        <proxool:proxool>  
            <proxool:alias>xml-test-ns-2</proxool:alias>  
            <proxool:driver-url>jdbc:hsqldb:db/test</proxool:driver-url>  
            <proxool:driver-class>org.hsqldb.jdbcDriver</proxool:driver-class>  
            <proxool:driver-properties>  
                <proxool:property name="user" value="sa"/>  
                <proxool:property name="password" value=""/>  
            </proxool:driver-properties>  
            <proxool:house-keeping-sleep-time>40000</proxool:house-keeping-sleep-time>  
            <proxool:house-keeping-test-sql>select CURRENT_DATE</proxool:house-keeping-test-sql>  
            <proxool:maximum-connection-count>10</proxool:maximum-connection-count>  
            <proxool:minimum-connection-count>3</proxool:minimum-connection-count>  
            <proxool:maximum-connection-lifetime>18000000</proxool:maximum-connection-lifetime> <!-- 5 hours -->  
            <proxool:simultaneous-build-throttle>5</proxool:simultaneous-build-throttle>  
            <proxool:recently-started-threshold>40000</proxool:recently-started-threshold>  
            <proxool:overload-without-refusal-lifetime>50000</proxool:overload-without-refusal-lifetime>  
            <proxool:maximum-active-time>60000</proxool:maximum-active-time>  
            <proxool:verbose>true</proxool:verbose>  
            <proxool:trace>true</proxool:trace>  
            <proxool:fatal-sql-exception>Fatal error</proxool:fatal-sql-exception>  
            <proxool:prototype-count>2</proxool:prototype-count>  
        </proxool:proxool>  
    </nothing-to-do-with-proxool>  
</something-else-entirely>  
 <?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Properties for Proxool Configurator testing. Defines the same parameters as
TestHelper.buildCompleteAlternativeProperties()
-->
<something-else-entirely xmlns="http://sumthin.else.entirely" xmlns:proxool="The latest version is available athttp://proxool.sourceforge.net/xml-namespace">
<proxool:proxool>
<proxool:alias>xml-test-ns</proxool:alias>
<proxool:driver-url>jdbc:hsqldb:db/test</proxool:driver-url>
<proxool:driver-class>org.hsqldb.jdbcDriver</proxool:driver-class>
<proxool:driver-properties>
<proxool:property name="user" value="sa"/>
<proxool:property name="password" value=""/>
</proxool:driver-properties>
<proxool:house-keeping-sleep-time>40000</proxool:house-keeping-sleep-time>
<proxool:house-keeping-test-sql>select CURRENT_DATE</proxool:house-keeping-test-sql>
<proxool:maximum-connection-count>10</proxool:maximum-connection-count>
<proxool:minimum-connection-count>3</proxool:minimum-connection-count>
<proxool:maximum-connection-lifetime>18000000</proxool:maximum-connection-lifetime> <!-- 5 hours -->
<proxool:simultaneous-build-throttle>5</proxool:simultaneous-build-throttle>
<proxool:recently-started-threshold>40000</proxool:recently-started-threshold>
<proxool:overload-without-refusal-lifetime>50000</proxool:overload-without-refusal-lifetime>
<proxool:maximum-active-time>60000</proxool:maximum-active-time>
<proxool:verbose>true</proxool:verbose>
<proxool:trace>true</proxool:trace>
<proxool:fatal-sql-exception>Fatal error</proxool:fatal-sql-exception>
<proxool:prototype-count>2</proxool:prototype-count>
</proxool:proxool>
<nothing-to-do-with-proxool>
<proxool:proxool>
<proxool:alias>xml-test-ns-2</proxool:alias>
<proxool:driver-url>jdbc:hsqldb:db/test</proxool:driver-url>
<proxool:driver-class>org.hsqldb.jdbcDriver</proxool:driver-class>
<proxool:driver-properties>
<proxool:property name="user" value="sa"/>
<proxool:property name="password" value=""/>
</proxool:driver-properties>
<proxool:house-keeping-sleep-time>40000</proxool:house-keeping-sleep-time>
<proxool:house-keeping-test-sql>select CURRENT_DATE</proxool:house-keeping-test-sql>
<proxool:maximum-connection-count>10</proxool:maximum-connection-count>
<proxool:minimum-connection-count>3</proxool:minimum-connection-count>
<proxool:maximum-connection-lifetime>18000000</proxool:maximum-connection-lifetime> <!-- 5 hours -->
<proxool:simultaneous-build-throttle>5</proxool:simultaneous-build-throttle>
<proxool:recently-started-threshold>40000</proxool:recently-started-threshold>
<proxool:overload-without-refusal-lifetime>50000</proxool:overload-without-refusal-lifetime>
<proxool:maximum-active-time>60000</proxool:maximum-active-time>
<proxool:verbose>true</proxool:verbose>
<proxool:trace>true</proxool:trace>
<proxool:fatal-sql-exception>Fatal error</proxool:fatal-sql-exception>
<proxool:prototype-count>2</proxool:prototype-count>
</proxool:proxool>
</nothing-to-do-with-proxool>
</something-else-entirely>

 
属性列表说明:

fatal-sql-exception: 它是一个逗号分割的信息片段.当一个SQL异常发生时,他的异常信息将与这个信息片段进行比较.如果在片段中存在,那么这个异常将被认为是个致命错误 (Fatal SQL Exception ).这种情况下,数据库连接将要被放弃.无论发生什么,这个异常将会被重掷以提供给消费者.用户最好自己配置一个不同的异常来抛出.

fatal-sql-exception-wrapper-class:正如上面所说,你最好配置一个不同的异常来重掷.利用这个属性,用户可以包装SQLException,使他变成另外一个异常.这个异常或者继承 SQLException或者继承字RuntimeException.proxool自带了2个实现:'org.logicalcobwebs.proxool.FatalSQLException' 和'org.logicalcobwebs.proxool.FatalRuntimeException' .后者更合适.

house-keeping-sleep-time: house keeper 保留线程处于睡眠状态的最长时间,house keeper 的职责就是检查各个连接的状态,并判断是否需要销毁或者创建.

house-keeping-test-sql:  如果发现了空闲的数据库连接.house keeper 将会用这个语句来测试.这个语句最好非常快的被执行.如果没有定义,测试过程将会被忽略。

injectable-connection-interface: 允许proxool实现被代理的connection对象的方法.

injectable-statement-interface: 允许proxool实现被代理的Statement 对象方法.

injectable-prepared-statement-interface: 允许proxool实现被代理的PreparedStatement 对象方法.

injectable-callable-statement-interface: 允许proxool实现被代理的CallableStatement 对象方法.

jmx: 略

jmx-agent-id: 略

jndi-name: 数据源的名称

maximum-active-time: 如果housekeeper 检测到某个线程的活动时间大于这个数值.它将会杀掉这个线程.所以确认一下你的服务器的带宽.然后定一个合适的值.默认是5分钟.

maximum-connection-count: 最大的数据库连接数.

maximum-connection-lifetime: 一个线程的最大寿命.

minimum-connection-count: 最小的数据库连接数

overload-without-refusal-lifetime: 略

prototype-count: 连接池中可用的连接数量.如果当前的连接池中的连接少于这个数值.新的连接将被建立(假设没有超过最大可用数).例如.我们有3个活动连接2个可用连接, 而我们的prototype-count是4,那么数据库连接池将试图建立另外2个连接.这和 minimum-connection-count不同. minimum-connection-count把活动的连接也计算在内.prototype-count 是spare connections 的数量.

recently-started-threshold:  略

simultaneous-build-throttle:  略

statistics:  连接池使用状况统计。 参数“10s,1m,1d”

statistics-log-level:  日志统计跟踪类型。 参数“ERROR”或 “INFO”

test-before-use: 略

test-after-use: 略

trace: 如果为true,那么每个被执行的SQL语句将会在执行期被log记录(DEBUG LEVEL).你也可以注册一个ConnectionListener (参看ProxoolFacade)得到这些信息.

verbose: 详细信息设置。 参数 bool 值

你可能感兴趣的:(proxool)