tomcat连接池之context.xml中属性探索

tomcat配置中是可以在context.xml中配置数据库连接池相关信息的,tomcat中间件通过自己的tomcat-jdbc.jar包实现了jdbc数据库的连接,有时我们不紧想知道那几个基础配置信息,还想深入了解其他配置属性。这时我们去tomcat lib目录下寻找答案。

找到tomcat-jdbc.jar打开来,里面org\apache\tomcat\jdbc\pool目录下有我们要找的答案,mbeans-descriptors.xml ,通过里面的英文注释我们可以详细得知具体配置属性。

<?xml version="1.0"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<mbeans-descriptors>

    <mbean        name="TomcatJDBCPool"
           description="Provides per diagnostic metrics and notifications for JDBC operations"
                domain="tomcat"
                 group="jdbc"
                  type="org.apache.tomcat.jdbc.pool.DataSource">

    <attribute    name="className"
           description="Fully qualified class name of the managed object"
                  type="java.lang.String"
             writeable="false"/>

    <attribute    name="size"
           description="The number of established connections in the pool, idle and in use"
                  type="java.lang.Integer"
             writeable="false"/>

    <attribute    name="idle"
           description="The number of established connections in the pool that are idle"
                  type="java.lang.Integer"
             writeable="false"/>

    <attribute    name="numIdle"
           description="Same as the idle attribute"
                  type="java.lang.Integer"
             writeable="false"/>

    <attribute    name="active"
           description="The number of established connections in the pool that are in use"
                  type="java.lang.Integer"
             writeable="false"/>

    <attribute    name="numActive"
           description="Same as the active attribute"
                  type="java.lang.Integer"
             writeable="false"/>

    <attribute    name="poolSweeperEnabled"
           description="Returns true if the pool has a background thread running"
                  type="java.lang.Boolean"
                    is="true"
             writeable="false"/>

    <attribute    name="url"
           description="The JDBC url for this connection pool"
                  type="java.lang.String"
             writeable="false"/>

    <attribute    name="driverClassName"
           description="The JDBC driver class for this connection pool"
                  type="java.lang.String"
             writeable="false"/>

    <attribute    name="defaultAutoCommit"
           description="The JDBC auto commit setting for new connections"
                  type="java.lang.Boolean"
                    is="true"
             writeable="false"/>

    <attribute    name="defaultReadOnly"
           description="The JDBC read only setting for new connections"
                  type="java.lang.Boolean"
                    is="true"
             writeable="false"/>

    <attribute    name="defaultTransactionIsolation"
           description="The JDBC transaction isolation setting for new connections"
                  type="java.lang.Integer"
             writeable="false"/>

    <attribute    name="connectionProperties"
           description="The connection properties that will be set for new connections. Format of the string will be [propertyName=property;]*"
                  type="java.lang.String"
             writeable="false"/>

    <attribute    name="defaultCatalog"
           description="The JDBC transaction isolation setting for new connections"
                  type="java.lang.String"
             writeable="false"/>

    <attribute    name="initialSize"
           description="The number of connections opened at pool startup"
                  type="java.lang.Integer"
             writeable="false"/>

    <attribute    name="maxActive"
           description="The maximum number of open connections"
                  type="java.lang.Integer"
             writeable="false"/>

    <attribute    name="maxIdle"
           description="The max number of idle connections"
                  type="java.lang.Integer"
             writeable="false"/>

    <attribute    name="minIdle"
           description="The minimum number of open connections"
                  type="java.lang.Integer"
             writeable="false"/>

    <attribute    name="maxWait"
           description="The time to wait in milliseconds before a SQLException is thrown when a connection is requested"
                  type="java.lang.Integer"
             writeable="false"/>

    <attribute    name="validationQuery"
           description="The query to run during validation"
                  type="java.lang.String"
             writeable="false"/>

    <attribute    name="validationQueryTimeout"
           description="The timeout in seconds before a connection validation queries fail"
                  type="java.lang.Integer"
             writeable="false" />

    <attribute    name="testOnBorrow"
           description="True if validation happens when a connection is requested"
                  type="java.lang.Boolean"
                    is="true"
             writeable="false"/>

    <attribute    name="testOnReturn"
           description="True if validation happens when a connection is returned"
                  type="java.lang.Boolean"
                    is="true"
             writeable="false"/>

    <attribute    name="testWhileIdle"
           description="True if validation happens when a connection is not in use (idle)"
                  type="java.lang.Boolean"
                    is="true"
             writeable="false"/>

    <attribute    name="timeBetweenEvictionRunsMillis"
           description="Sleep time for background thread in between pool checks"
                  type="java.lang.Integer"
             writeable="false"/>

    <attribute    name="numTestsPerEvictionRun"
           description="Not in use"
                  type="java.lang.Integer"
             writeable="false"/>

    <attribute    name="minEvictableIdleTimeMillis"
           description="Minimum amount of time a connection stays idle before it is evicted"
                  type="java.lang.Integer"
             writeable="false"/>

    <attribute    name="accessToUnderlyingConnectionAllowed"
           description="Returns true if one can retrieve the actual JDBC connection"
                  type="java.lang.Boolean"
                    is="true"
             writeable="false"/>

    <attribute    name="removeAbandoned"
           description="Returns true if connection in use can be timed out"
                  type="java.lang.Boolean"
                    is="true"
             writeable="false"/>

    <attribute    name="removeAbandonedTimeout"
           description="Timeout in seconds for connections in use"
                  type="java.lang.Integer"
             writeable="false"/>

    <attribute    name="logAbandoned"
           description="If true, stack trace will be recorded and printed out for timed out connection"
                  type="java.lang.Boolean"
                    is="true"
             writeable="false"/>

    <attribute    name="loginTimeout"
           description="Not in use"
                  type="java.lang.Integer"
             writeable="false"/>


    <attribute    name="name"
           description="The name of the connection pool, will be used in the ObjectName of the actual pool"
                  type="java.lang.String"
             writeable="false"/>

    <attribute    name="password"
           description="For security purposes,this doesn't return anything"
                  type="java.lang.String"
             writeable="false"/>

    <attribute    name="username"
           description="The username used to open connections"
                  type="java.lang.String"
             writeable="false"/>

    <attribute    name="validationInterval"
           description="If larger than zero than validation will only occur after the interval milliseconds has passed"
                  type="java.lang.Long"
             writeable="false"/>

    <attribute    name="initSQL"
           description="A SQL executed once per connection, when it is established"
                  type="java.lang.String"
             writeable="false"/>

    <attribute    name="testOnConnect"
           description="Validate connection after connection has been established"
                  type="java.lang.Boolean"
                    is="true"
             writeable="false"/>

    <attribute    name="jdbcInterceptors"
           description="The interceptors configured for this pool"
                  type="java.lang.String"
             writeable="false"/>

<attribute    name="jmxEnabled"
           description="Register the pool with JMX or not"
                  type="java.lang.Boolean"
                    is="true"
             writeable="false"/>

    <attribute    name="fairQueue"
           description="a fair queue is being used by the connection pool"
                  type="java.lang.Boolean"
                    is="true"
             writeable="false"/>

    <attribute    name="abandonWhenPercentageFull"
           description="Connections that have been abandoned isn't closed unless connections in use are above this percentage"
                  type="java.lang.Integer"
             writeable="false"/>

    <attribute    name="maxAge"
           description="Time in milliseconds to keep this connection alive even when used"
                  type="java.lang.Long"
             writeable="false"/>

    <attribute    name="useEquals"
           description="Set to true if you wish the ProxyConnection class to use String.equals and set to false when you wish to use == when comparing method names"
                  type="java.lang.Boolean"
                    is="true"
             writeable="false"/>

    <attribute    name="useLock"
           description="If true, use a lock when operations are performed on the connection object"
                  type="java.lang.Boolean"
                    is="false"
             writeable="false"/>

    <attribute    name="suspectTimeout"
           description="Timeout in seconds for connection that suspected to have been abandoned"
                  type="java.lang.Integer"
             writeable="false"/>

    <attribute    name="rollbackOnReturn"
           description="If autoCommit==false then the pool can terminate the transaction by calling rollback on the connection as it is returned to the pool"
                  type="java.lang.Boolean"
                    is="false"
             writeable="false"/>

    <attribute    name="commitOnReturn"
           description="If autoCommit==false then the pool can complete the transaction by calling commit on the connection as it is returned to the pool"
                  type="java.lang.Boolean"
                    is="false"
             writeable="false"/>

    <attribute    name="alternateUsernameAllowed"
           description="If true, getConnection(username,password) is allowed"
                  type="java.lang.Boolean"
                    is="true"
             writeable="false"/>

    <attribute    name="dataSource"
           description="Data source that is injected into the pool"
                  type="javax.sql.DataSource"
             writeable="false"/>

    <attribute    name="dataSourceJNDI"
           description="The JNDI name for a data source to be looked up"
                  type="java.lang.String"
             writeable="false"/>

    <attribute    name="useDisposableConnectionFacade"
           description="If true, connection pool is configured to use a connection facade to prevent re-use of connection after close() has been invoked"
                  type="java.lang.Boolean"
                    is="false"
             writeable="false"/>

    <attribute    name="logValidationErrors"
           description="Log errors during the validation phase to the log file"
                  type="java.lang.Boolean"
                    is="false"
             writeable="false"/>

    <attribute    name="validatorClassName"
           description="The name of validator class which implements org.apache.tomcat.jdbc.pool.Validator interface"
                  type="java.lang.String"
             writeable="false"/>

    <attribute    name="waitCount"
           description="The number of threads waiting for a connection"
                  type="java.lang.Integer"
             writeable="false"/>

    <attribute    name="propagateInterruptState"
           description="If true, propagate the interrupt state for a thread that has been interrupted"
                  type="java.lang.Boolean"
                    is="false"
             writeable="false"/>

    <attribute    name="ignoreExceptionOnPreLoad"
           description="If true, ignore error of connection creation while initializing the pool"
                  type="java.lang.Boolean"
                    is="true"
             writeable="false"/>

    <operation    name="checkIdle"
                  description="forces a check of idle connections"
                  impact="ACTION"
                  returnType="void" />

    <operation    name="checkAbandoned"
                  description="forces a check of abandoned connections"
                  impact="ACTION"
                  returnType="void" />

    <operation    name="testIdle"
                  description="forces a validation of abandoned connections"
                  impact="ACTION"
                  returnType="void" />

    <operation    name="purge"
                  description="Purges all connections in the pool"
                  impact="ACTION"
                  returnType="void" />

    <operation    name="purgeOnReturn"
                  description="Purges connections when they are returned from the pool"
                  impact="ACTION"
                  returnType="void" />

  </mbean>

</mbeans-descriptors>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值