From a8d5574d38a2026c92888e7156f503565aaa266b Mon Sep 17 00:00:00 2001 From: ZhangZiSheng001 <18826241741@163.com> Date: Wed, 27 Nov 2019 08:38:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E9=83=A8=E5=88=86=E6=BA=90?= =?UTF-8?q?=E7=A0=81=E5=88=86=E6=9E=90=EF=BC=8C=E5=8F=8A=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=BE=8B=E5=AD=90=EF=BC=8C=E5=90=8E=E9=9D=A2?= =?UTF-8?q?=E8=BF=98=E7=BB=A7=E7=BB=AD=E8=A1=A5=E5=85=85InstanceKeyDataSou?= =?UTF-8?q?rce=E5=92=8CBasicManagedDataSource=E7=9A=84=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E4=BE=8B=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1296 +- img/dbcp-Connection.cld | 7779 ++++++++++ img/dbcp-dataSource.cld | 11772 ++++++++++++++++ .../java/cn/zzs/dbcp/BasicDataSourceUtil.java | 184 + src/main/java/cn/zzs/dbcp/JDBCUtil.java | 136 - src/main/resources/jdbc.properties | 246 +- src/main/resources/log4j.properties | 180 +- src/main/resources/sql/demo_user.sql | 45 + .../java/cn/zzs/dbcp/BasicDataSourceTest.java | 152 + src/test/java/cn/zzs/dbcp/DBCPTest.java | 146 - .../zzs/dbcp/InstanceKeyDataSourceTest.java | 22 + 11 files changed, 21135 insertions(+), 823 deletions(-) create mode 100644 img/dbcp-Connection.cld create mode 100644 img/dbcp-dataSource.cld create mode 100644 src/main/java/cn/zzs/dbcp/BasicDataSourceUtil.java delete mode 100644 src/main/java/cn/zzs/dbcp/JDBCUtil.java create mode 100644 src/main/resources/sql/demo_user.sql create mode 100644 src/test/java/cn/zzs/dbcp/BasicDataSourceTest.java delete mode 100644 src/test/java/cn/zzs/dbcp/DBCPTest.java create mode 100644 src/test/java/cn/zzs/dbcp/InstanceKeyDataSourceTest.java diff --git a/README.md b/README.md index d8f7b79..037a015 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,40 @@ - -# DBCP - -## 简介 -DBCP用于创建和管理连接,利用连接池的方式复用连接减少了资源开销。 +# 简介 +DBCP用于创建和管理连接,利用“池”的方式复用连接对象,减少了资源开销。 连接池的参数可以采用`properties`文件来配置:配置包括驱动、链接、账号密码,连接池基本参数,事务相关参数,连接测试的参数以及内存回收参数等。 -DBCP对外交互主要是一个`BasicDataDource`,用于设置连接池参数和获取连接对象,作用有点类似于JDK的`DriverManager`。通过源码可以看到,`BasicDataSource`内部有一个`dataSource` 和`connectionPool`字段。 - -`dataSource`用于从连接池中获取连接。 -`connectionPool`用于创建,存储和管理池中的连接,里面有一个`Map`对象和`LinkedBlockingDeque`对象,分别存储着所有连接和空闲连接,构成所谓的“池”。 - - -## 使用例子 -### 需求 +# 使用例子 +## 需求 使用DBCP连接池获取连接对象,对用户数据进行增删改查。 -### 工程环境 +## 工程环境 JDK:1.8.0_201 + maven:3.6.1 -IDE:Spring Tool Suites4 for Eclipse -mysql驱动:8.0.15 -mysql:5.7 - -### 主要步骤 -DBCP对外交互主要是一个`BasicDataDource`,用于设置连接池参数和获取连接对象。 -1. 通过`BasicDataSourceFactory.createDataSource(properties)`设置连接池参数,并获得`BasicDataDource`对象; -2. 获取连接对象:调用`BasicDataDource`对象的`getConnection()`方法获取`Connection`对象。 - -### 创建表 -```sql -CREATE DATABASE `demo`CHARACTER SET utf8 COLLATE utf8_bin; -User `demo`; -CREATE TABLE `user` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '用户id', - `name` varchar(32) COLLATE utf8_bin NOT NULL COMMENT '用户名', - `age` int(10) unsigned DEFAULT NULL COMMENT '用户年龄', - `gmt_create` datetime DEFAULT NULL COMMENT '记录创建时间', - `gmt_modified` datetime DEFAULT NULL COMMENT '记录最后修改时间', - PRIMARY KEY (`id`), - UNIQUE KEY `uk_name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -``` -### 创建项目 -项目类型Maven Project,打包方式jar +IDE:STS4 + +mysql-connector-java:8.0.15 + +mysql:5.7 + +DBCP:2.6.0 + + +## 主要步骤 + +1. 编写`jdbc.properties`,设置数据库连接参数和连接池参数。 + +2. 通过`BasicDataSourceFactory`加载`jdbc.properties`,并获得`BasicDataDource`对象。 -### 引入依赖 +3. 通过`BasicDataDource`对象获取`Connection`对象。 + +4. 使用`Connection`对象对用户表进行增删改查。 + +## 创建项目 +项目类型Maven Project,打包方式jar。 + +## 引入依赖 ```xml @@ -75,399 +63,296 @@ CREATE TABLE `user` ( ``` -### 编写jdbc.prperties -路径:resources目录下 +## 编写jdbc.prperties +路径resources目录下,考虑篇幅,这里仅给出数据库连接参数和连接池参数,具体参见项目源码。另外,数据库sql脚本也在该目录下。 + ```properties -#数据库配置 +#数据库基本配置 driverClassName=com.mysql.cj.jdbc.Driver -url=jdbc:mysql://localhost:3306/demo?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=true +url=jdbc:mysql://localhost:3306/github_demo?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=true username=root password=root + +#-------------连接数据相关参数-------------------------------- +#初始化连接:连接池启动时创建的初始化连接数量 +#默认为0 +initialSize=0 +#最大活动连接 +#连接池在同一时间能够分配的最大活动连接的数量, 如果设置为非正数则表示不限制 +#默认为8 +maxActive=8 +#最大空闲连接 +#连接池中容许保持空闲状态的最大连接数量,超过的空闲连接将被释放,如果设置为负数表示不限制 +#默认为8 +maxIdle=8 +#最小空闲连接 +#连接池中容许保持空闲状态的最小连接数量,低于这个数量将创建新的连接,如果设置为0则不创建 +#默认为0 +minIdle=0 +#最大等待时间 +#当没有可用连接时,连接池等待连接被归还的最大时间(以毫秒计数),超过时间则抛出异常,如果设置为-1表示无限等待 +#默认无限 +maxWait=-1 ``` -### 编写JDBCUtil用于获得连接对象 -这里设置工具类的目的是避免多个线程使用同一个连接对象,并提供了释放资源的方法(注意,考虑到重用性,这里并不会关闭连接)。 +## 获取连接池和获取连接 +项目中编写了JDBCUtil来初始化连接池、获取连接、管理事务和释放资源等,具体参见项目源码。 + 路径:`cn.zzs.dbcp` ```java -/** - * @ClassName: JDBCUtil - * @Description: 用于获取数据库连接对象的工具类 - * @author: zzs - * @date: 2019年8月31日 下午9:05:08 - */ -public class JDBCUtil { - private static DataSource dataSource; - private static ThreadLocal tl = new ThreadLocal<>(); - private static Object obj = new Object(); - - static { - init(); - } - /** - * - * @Title: getConnection - * @Description: 获取数据库连接对象的方法,线程安全 - * @author: zzs - * @date: 2019年8月31日 下午9:22:29 - * @return: Connection - */ - public static Connection getConnection(){ - //从当前线程中获取连接对象 - Connection connection = tl.get(); - //判断为空的话,创建连接并绑定到当前线程 - if(connection == null) { - synchronized (obj) { - if(tl.get() == null) { - connection = createConnection(); - tl.set(connection); - } - } - } - return connection; - } - /** - * - * @Title: release - * @Description: 释放资源 - * @author: zzs - * @date: 2019年8月31日 下午9:39:24 - * @param conn - * @param statement - * @return: void - */ - public static void release(Connection conn,Statement statement,ResultSet resultSet) { - if(resultSet!=null) { - try { - resultSet.close(); - } catch (SQLException e) { - System.err.println("关闭ResultSet对象异常"); - e.printStackTrace(); - } - } - if(statement != null) { - try { - statement.close(); - } catch (SQLException e) { - System.err.println("关闭Statement对象异常"); - e.printStackTrace(); - } - } - //注意:这里不关闭连接 - if(conn!=null) { - try { - //如果连接失效的话,从当前线程的绑定中删除 - if(!conn.isValid(3)) { - tl.remove(); - } - } catch (SQLException e) { - System.err.println("校验连接有效性"); - e.printStackTrace(); - } - } - } - - /** - * - * @Title: createConnection - * @Description: 创建数据库连接 - * @author: zzs - * @date: 2019年8月31日 下午9:27:03 - * @return: Connection - */ - private static Connection createConnection(){ - Connection conn = null; - //获得连接 - try { - conn = dataSource.getConnection(); - } catch (SQLException e) { - System.err.println("从数据源获取连接失败"); - e.printStackTrace(); - } - return conn; - } - - /** - * @Title: init - * @Description: 根据指定配置文件创建数据源对象 - * @author: zzs - * @date: 2019年9月1日 上午10:53:05 - * @return: void - */ - private static void init() { - //导入配置文件 - Properties properties = new Properties(); - InputStream in = JDBCUtil.class.getClassLoader().getResourceAsStream("jdbc.properties"); - try { - properties.load(in); - //根据配置文件内容获得数据源对象 - dataSource = BasicDataSourceFactory.createDataSource(properties); - } catch (IOException e) { - System.err.println("导入配置文件出错"); - e.printStackTrace(); - } catch (Exception e) { - System.err.println("根据指定配置文件创建数据源出错"); - e.printStackTrace(); - } - } -} - + // 导入配置文件 + Properties properties = new Properties(); + InputStream in = JDBCUtil.class.getClassLoader().getResourceAsStream("jdbc.properties"); + properties.load(in); + // 根据配置文件内容获得数据源对象 + DataSource dataSource = BasicDataSourceFactory.createDataSource(properties); + // 获得连接 + Connection conn = dataSource.getConnection(); ``` -### 编写测试类 -路径:test目录下的`cn.zzs.jdbc` +## 编写测试类 +这里以保存用户为例,路径test目录下的`cn.zzs.dbcp`。 -#### 添加用户 -注意:这里引入了事务 ```java -/** - * 测试添加用户 - * @throws SQLException - */ -@Test -public void saveUser() throws Exception { - //创建sql - String sql = "insert into user values(null,?,?,?,?)"; - //获得连接 - Connection connection = JDBCUtil.getConnection(); - PreparedStatement statement = null; - try { - //设置非自动提交 - connection.setAutoCommit(false); - //获得Statement对象 - statement = connection.prepareStatement(sql); - //设置参数 - statement.setString(1, "zzs001"); - statement.setInt(2, 18); - statement.setDate(3, new Date(System.currentTimeMillis())); - statement.setDate(4, new Date(System.currentTimeMillis())); - //执行 - statement.executeUpdate(); - //提交事务 - connection.commit(); - } catch (Exception e) { - System.out.println("异常导致操作回滚"); - connection.rollback(); - e.printStackTrace(); - } finally { - //释放资源 - JDBCUtil.release(connection, statement,null); - } -} -``` -#### 更新用户 -```java -/** - * 测试更新用户 - */ -@Test -public void updateUser() throws Exception { - //创建sql - String sql = "update user set age = ?,gmt_modified = ? where name = ?"; - //获得连接 - Connection connection = JDBCUtil.getConnection(); - PreparedStatement statement = null; - try { - //设置非自动提交 - connection.setAutoCommit(false); - //获得Statement对象 - statement = connection.prepareStatement(sql); - //设置参数 - statement.setInt(1, 19); - statement.setDate(2, new Date(System.currentTimeMillis())); - statement.setString(3, "zzs001"); - //执行 - statement.executeUpdate(); - //提交事务 - connection.commit(); - } catch (Exception e) { - System.out.println("异常导致操作回滚"); - connection.rollback(); - e.printStackTrace(); - } finally { - //释放资源 - JDBCUtil.release(connection, statement,null); - } -} -``` -#### 查询用户 -```java -/** - * 测试查找用户 - */ -@Test -public void findUser() throws Exception { - //创建sql - String sql = "select * from user where name = ?"; - //获得连接 - Connection connection = JDBCUtil.getConnection(); - PreparedStatement statement = null; - ResultSet resultSet = null; - try { - //获得Statement对象 - statement = connection.prepareStatement(sql); - //设置参数 - statement.setString(1, "zzs001"); - //执行 - resultSet = statement.executeQuery(); - //遍历结果集 - while (resultSet.next()) { - String name = resultSet.getString(2); - int age = resultSet.getInt(3); - System.out.println("用户名:" + name + ",年龄:" + age); + @Test + public void save() { + // 创建sql + String sql = "insert into demo_user values(null,?,?,?,?,?)"; + Connection connection = null; + PreparedStatement statement = null; + try { + // 获得连接 + connection = JDBCUtil.getConnection(); + // 开启事务设置非自动提交 + JDBCUtil.startTrasaction(); + // 获得Statement对象 + statement = connection.prepareStatement(sql); + // 设置参数 + statement.setString(1, "zzf003"); + statement.setInt(2, 18); + statement.setDate(3, new Date(System.currentTimeMillis())); + statement.setDate(4, new Date(System.currentTimeMillis())); + statement.setBoolean(5, false); + // 执行 + statement.executeUpdate(); + // 提交事务 + JDBCUtil.commit(); + } catch(Exception e) { + JDBCUtil.rollback(); + log.error("保存用户失败", e); + } finally { + // 释放资源 + JDBCUtil.release(connection, statement, null); } - } finally { - //释放资源 - JDBCUtil.release(connection, statement,resultSet); - } -} -``` -#### 删除用户 -```java -/** - * 测试删除用户 - */ -@Test -public void deleteUser() throws Exception { - //创建sql - String sql = "delete from user where name = ?"; - //获得连接 - Connection connection = JDBCUtil.getConnection(); - PreparedStatement statement = null; - try { - //设置非自动提交 - connection.setAutoCommit(false); - //获得Statement对象 - statement = connection.prepareStatement(sql); - //设置参数 - statement.setString(1, "zzs001"); - //执行 - statement.executeUpdate(); - //提交事务 - connection.commit(); - } catch (Exception e) { - System.out.println("异常导致操作回滚"); - connection.rollback(); - e.printStackTrace(); - } finally { - //释放资源 - JDBCUtil.release(connection, statement,null); } -} ``` -### dbcp配置文件详解 -#### 数据库基本配置 +# 配置文件详解 +这部分内容从网上参照过来,因为发的到处都是,所以暂时没找到出处。因为最新版本更新了不少内容,所以我修正了下,后面找到出处再补上参考资料。 + +## 数据库基本配置 +注意,这里在url后面拼接了多个参数用于避免乱码、时区报错问题。 + ```properties driverClassName=com.mysql.cj.jdbc.Driver -url=jdbc:mysql://localhost:3306/demo?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=true +url=jdbc:mysql://localhost:3306/github_demo?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=true username=root password=root ``` -#### 连接数据相关参数 + +## 连接池数据相关参数 +这几个参数都比较常用,具体设置多少需根据具体项目调整。 + ```properties #-------------连接数据相关参数-------------------------------- -#初始化连接:连接池启动时创建的初始化连接数量 +#初始化连接数量:连接池启动时创建的初始化连接数量 #默认为0 initialSize=0 -#最大活动连接 -#连接池在同一时间能够分配的最大活动连接的数量, 如果设置为非正数则表示不限制 + +#最大活动连接数量:连接池在同一时间能够分配的最大活动连接的数量, 如果设置为负数则表示不限制 #默认为8 -maxActive=8 -#最大空闲连接 -#连接池中容许保持空闲状态的最大连接数量,超过的空闲连接将被释放,如果设置为负数表示不限制 +maxTotal=8 + +#最大空闲连接:连接池中容许保持空闲状态的最大连接数量,超过的空闲连接将被释放,如果设置为负数表示不限制 #默认为8 maxIdle=8 -#最小空闲连接 -#连接池中容许保持空闲状态的最小连接数量,低于这个数量将创建新的连接,如果设置为0则不创建 + +#最小空闲连接:连接池中容许保持空闲状态的最小连接数量,低于这个数量将创建新的连接,如果设置为0则不创建 +#注意:需要开启空闲对象回收器,这个参数才能生效。 #默认为0 minIdle=0 + #最大等待时间 -#当没有可用连接时,连接池等待连接被归还的最大时间(以毫秒计数),超过时间则抛出异常,如果设置为-1表示无限等待 -#默认无限 -maxWait=-1 +#当没有可用连接时,连接池等待连接被归还的最大时间(以毫秒计数),超过时间则抛出异常,如果设置为<=0表示无限等待 +#默认-1 +maxWaitMillis=-1 ``` -#### 事务相关的属性 -```properties -#-------------事务相关的属性-------------------------------- -#连接池创建的连接的默认的auto-commit状态 -#默认为true -defaultAutoCommit=false -#连接池创建的连接的默认的read-only状态. 如果没有设置则setReadOnly方法将不会被调用. (某些驱动不支持只读模式,比如:Informix) -#默认值由驱动决定 -#defaultReadOnly=false -#连接池创建的连接的默认的TransactionIsolation状态 -#可用值为下列之一:NONE,READ_UNCOMMITTED, READ_COMMITTED, REPEATABLE_READ, SERIALIZABLE -#默认值由驱动决定 -defaultTransactionIsolation=REPEATABLE_READ -#连接池创建的连接的默认的catalog -#defaultCatalog -``` -#### 连接检查情况 +## 连接检查情况 + ```properties #-------------连接检查情况-------------------------------- -#SQL查询,用来验证从连接池取出的连接,在将连接返回给调用者之前.如果指定,则查询必须是一个SQL SELECT并且必须返回至少一行记录 -validationQuery= select 1 -#指明是否在从池中取出连接前进行检验,如果检验失败,则从池中去除连接并尝试取出另一个. -#注意: 设置为true后如果要生效,validationQuery参数必须设置为非空字符串 +#通过SQL查询检测连接,注意必须返回至少一行记录 +#默认为空。即会调用Connection的isValid和isClosed进行检测 +#注意:如果是oracle数据库的话,应该改为select 1 from dual +validationQuery=select 1 from dual + +#SQL检验超时时间 +validationQueryTimeout=-1 + +#是否从池中取出连接前进行检验。 #默认为true testOnBorrow=true -#指明是否在归还到池中前进行检验 -#注意: 设置为true后如果要生效,validationQuery参数必须设置为非空字符串 + +#是否在归还到池中前进行检验 #默认为false testOnReturn=false -#是否开启空闲资源监测。 -#注意: 设置为true后如果要生效,validationQuery参数必须设置为非空字符串 + +#是否开启空闲对象回收器。 #默认为false -testWhileIdle= true -#空闲资源的检测周期(单位为毫秒)。默认-1:不检测。建议设置,周期自行选择。timeBetweenEvictionRunsMillis=30000 -#做空闲资源检测时,每次的采样数。默认3。 -#可根据自身应用连接数进行微调,如果设置为-1,就是对所有连接做空闲监测。 +testWhileIdle=false + +#空闲对象回收器的检测周期(单位为毫秒)。 +#默认-1。即空闲对象回收器不工作。 +timeBetweenEvictionRunsMillis=-1 + +#做空闲对象回收器时,每次的采样数。 +#默认3,单位毫秒。如果设置为-1,就是对所有连接做空闲监测。 numTestsPerEvictionRun=3 -#资源池中资源最小空闲时间(单位为毫秒),达到此值后空闲资源将被移除。 -#默认值1000*60*30 = 30分钟。建议默认,或根据自身业务选择。 + +#资源池中资源最小空闲时间(单位为毫秒),达到此值后将被移除。 +#默认值1000*60*30 = 30分钟 minEvictableIdleTimeMillis=1800000 + +#资源池中资源最小空闲时间(单位为毫秒),达到此值后将被移除。但是会保证minIdle +#默认值-1 +#softMinEvictableIdleTimeMillis=-1 + +#空闲对象回收器的回收策略 +#默认org.apache.commons.pool2.impl.DefaultEvictionPolicy +#如果要自定义的话,需要实现EvictionPolicy重写evict方法 +evictionPolicyClassName=org.apache.commons.pool2.impl.DefaultEvictionPolicy + +#连接最大存活时间。非正数表示不限制 +#默认-1 +maxConnLifetimeMillis=-1 + +#当达到maxConnLifetimeMillis被关闭时,是否打印相关消息 +#默认true +#注意:maxConnLifetimeMillis设置为正数时,这个参数才有效 +logExpiredConnections=true ``` -#### 缓存语句 +## 缓存语句 ```properties #-------------缓存语句-------------------------------- -#开启池的prepared statement 池功能 -#注意: 确认连接还有剩余资源可以留给其他statement +#是否缓存PreparedStatements,这个功能在一些支持游标的数据库中可以极大提高性能(Oracle、SQL Server、DB2、Sybase) #默认为false poolPreparedStatements=false -#statement池能够同时分配的打开的statements的最大数量, 如果设置为0表示不限制 -#默认为0 -maxOpenPreparedStatements=0 + +#缓存PreparedStatements的最大个数 +#默认为-1 +#注意:poolPreparedStatements为true时,这个参数才有效 +maxOpenPreparedStatements=-1 + +#缓存read-only和auto-commit状态。设置为true的话,所有连接的状态都会是一样的。 +#默认是true +cacheState=true + +``` + +## 事务相关的属性 + +```properties +#-------------事务相关的属性-------------------------------- +#连接池创建的连接的默认的auto-commit状态 +#默认为空,由驱动决定 +defaultAutoCommit=true + +#连接池创建的连接的默认的read-only状态。 +#默认值为空,由驱动决定 +defaultReadOnly=false + +#连接池创建的连接的默认的TransactionIsolation状态 +#可用值为下列之一:NONE,READ_UNCOMMITTED, READ_COMMITTED, REPEATABLE_READ, SERIALIZABLE +#默认值为空,由驱动决定 +defaultTransactionIsolation=REPEATABLE_READ + +#归还连接时是否设置自动提交为true +#默认true +autoCommitOnReturn=true + +#归还连接时是否设置回滚事务 +#默认true +rollbackOnReturn=true + +#连接池创建的连接的默认的数据库名 +#defaultCatalog=github_demo + +#连接池创建的连接的默认的schema。如果是mysql,这个设置没什么用。 +#defaultSchema=github_demo ``` -#### 连接泄漏回收参数 +## 连接泄漏回收参数 ```properties #-------------连接泄漏回收参数-------------------------------- -#标记是否删除泄露的连接,如果他们超过了removeAbandonedTimout的限制. -#如果设置为true, 连接被认为是被泄露并且可以被删除,如果空闲时间超过removeAbandonedTimeout. -#设置为true可以为写法糟糕的没有关闭连接的程序修复数据库连接. +#当未使用的时间超过removeAbandonedTimeout时,是否视该连接为泄露连接并删除(当getConnection()被调用时检测) #默认为false -removeAbandoned=false +#注意:这个机制在(getNumIdle() < 2) and (getNumActive() > (getMaxActive() - 3))时被触发 +removeAbandonedOnBorrow=false + +#当未使用的时间超过removeAbandonedTimeout时,是否视该连接为泄露连接并删除 +#默认为false +#注意:当空闲对象回收器开启才生效 +removeAbandonedOnMaintenance=false + #泄露的连接可以被删除的超时值, 单位秒 #默认为300 removeAbandonedTimeout=300 + #标记当Statement或连接被泄露时是否打印程序的stack traces日志。 -#被泄露的Statements和连接的日志添加在每个连接打开或者生成新的Statement,因为需要生成stack trace。 #默认为false -logAbandoned=false -#如果开启"removeAbandoned",那么连接在被认为泄露时可能被池回收. -#这个机制在(getNumIdle() < 2) and (getNumActive() > getMaxActive() - 3)时被触发. -#举例当maxActive=20, 活动连接为18,空闲连接为1时可以触发"removeAbandoned". -#但是活动连接只有在没有被使用的时间超过"removeAbandonedTimeout"时才被删除,默认300秒.在resultset中游历不被计算为被使用. +logAbandoned=true + +#这个不是很懂 +#默认为false +abandonedUsageTracking=false + ``` -#### 其他 +## 其他 ```properties #-------------其他-------------------------------- +#是否使用快速失败机制 +#默认为空,由驱动决定 +fastFailValidation=false + +#当使用快速失败机制时,设置触发的异常码 +#多个code用","隔开 +#disconnectionSqlCodes + +#borrow连接的顺序 +#默认true +lifo=true + +#每个连接创建时执行的语句 +#connectionInitSqls= + +#连接参数:例如username、password、characterEncoding等都可以在这里设置 +#多个参数用";"隔开 +#connectionProperties= + +#指定数据源的jmx名 +#jmxName= + +#查询超时时间 +#默认为空,即根据驱动设置 +#defaultQueryTimeout= + #控制PoolGuard是否容许获取底层连接 #默认为false accessToUnderlyingConnectionAllowed=false + #如果容许则可以使用下面的方式来获取底层物理连接: # Connection conn = ds.getConnection(); # Connection dconn = ((DelegatingConnection) conn).getInnermostDelegate(); @@ -475,4 +360,677 @@ accessToUnderlyingConnectionAllowed=false # conn.close(); ``` -> 学习使我快乐!! +# 源码分析 +通过使用例子可知,DBCP的`BasicDataSource`是我们获取连接对象的入口,至于`BasicDataSourceFactory`只是创建和初始化`BasicDataSource`实例,就不看了。这里直接从`BasicDataSource`的`getConnection()`方法开始分析。 + +注意:考虑篇幅和可读性,以下代码经过删减,仅保留所需部分。 + +## 数据源创建 +研究数据源创建之前,先来看下DBCP的几种数据源: + +类名|描述 +-|- +BasicDataSource|用于满足基本数据库操作需求的数据源 +BasicManagedDataSource|BasicDataSource的子类,用于创建支持XA事务或JTA事务的连接 +PoolingDataSource|BasicDataSource中实际调用的数据源,可以说BasicDataSource只是封装了PoolingDataSource +ManagedDataSource|PoolingDataSource的子类,用于支持XA事务或JTA事务的连接。是BasicManagedDataSource中实际调用的数据源,可以说BasicManagedDataSource只是封装了ManagedDataSource +InstanceKeyDataSource|用于支持JDNI环境的数据源 +PerUserPoolDataSource|InstanceKeyDataSource的子类,针对每个用户会单独分配一个连接池,每个连接池可以设置不同属性。例如以下需求,相比user,admin可以创建更多地连接以保证 +SharedPoolDataSource|InstanceKeyDataSource的子类,不同用户共享一个连接池 + +本文的源码分析仅会涉及到BasicDataSource(包含它封装的PoolingDataSource),其他的数据源暂时不扩展。 + +### BasicDataSource.getConnection() +```java + public Connection getConnection() throws SQLException { + return createDataSource().getConnection(); + } +``` + +### BasicDataSource.createDataSource() +这里涉及到四个类,如下: + +类名 | 描述 +-|- +ConnectionFactory | 用于生成原生的Connection对象 +PoolableConnectionFactory | 用于生成包装过的Connection对象,持有ConnectionFactory对象的引用 +GenericObjectPool | 数据库连接池,用于管理连接。持有PoolableConnectionFactory对象的引用 +PoolingDataSource | 数据源,持有GenericObjectPool的引用。我们调用BasicDataSource获取连接对象,实际上调用的是它的getConnection()方法 + +```java + // 数据源 + private volatile DataSource dataSource; + // 连接池 + private volatile GenericObjectPool connectionPool; + + protected DataSource createDataSource() throws SQLException { + if (closed) { + throw new SQLException("Data source is closed"); + } + if (dataSource != null) { + return dataSource; + } + + synchronized (this) { + if (dataSource != null) { + return dataSource; + } + // 注册MBean,用于支持JMX,这方面的内容不在这里扩展 + jmxRegister(); + + // 创建原生Connection工厂:本质就是持有数据库驱动对象和几个连接参数 + final ConnectionFactory driverConnectionFactory = createConnectionFactory(); + + // 将driverConnectionFactory包装成池化Connection工厂 + boolean success = false; + PoolableConnectionFactory poolableConnectionFactory; + try { + poolableConnectionFactory = createPoolableConnectionFactory(driverConnectionFactory); + // 设置PreparedStatements缓存(其实上面创建工厂就设置了,这里没必要再设置一遍) + poolableConnectionFactory.setPoolStatements(poolPreparedStatements); + poolableConnectionFactory.setMaxOpenPreparedStatements(maxOpenPreparedStatements); + success = true; + } catch (final SQLException se) { + throw se; + } catch (final RuntimeException rte) { + throw rte; + } catch (final Exception ex) { + throw new SQLException("Error creating connection factory", ex); + } + + if (success) { + // 创建数据库连接池对象GenericObjectPool,用于管理连接 + // BasicDataSource将持有GenericObjectPool对象 + createConnectionPool(poolableConnectionFactory); + } + + // 创建PoolingDataSource对象 + //该对象持有GenericObjectPool对象的引用 + DataSource newDataSource; + success = false; + try { + newDataSource = createDataSourceInstance(); + newDataSource.setLogWriter(logWriter); + success = true; + } catch (final SQLException se) { + throw se; + } catch (final RuntimeException rte) { + throw rte; + } catch (final Exception ex) { + throw new SQLException("Error creating datasource", ex); + } finally { + if (!success) { + closeConnectionPool(); + } + } + + // 根据我们设置的initialSize创建初始连接 + try { + for (int i = 0; i < initialSize; i++) { + connectionPool.addObject(); + } + } catch (final Exception e) { + closeConnectionPool(); + throw new SQLException("Error preloading the connection pool", e); + } + + // 开启连接池的evictor线程 + startPoolMaintenance(); + // 最后BasicDataSource将持有上面创建的PoolingDataSource对象 + dataSource = newDataSource; + return dataSource; + } + } +``` + +## 获取连接对象 +在介绍下面内容前先了解下DBCP中几个Connection实现类。 + +类名|描述 +-|- +DelegatingConnection|Connection实现类,是以下几个类的父类 +PoolingConnection|用于包装原生的Connection,支持prepareStatement和prepareCall +PoolableConnection|用于包装原生的PoolingConnection(如果没有开启poolPreparedStatements,则包装的只是原生Connection),调用close()时只是将连接还给连接池 +PoolableManagedConnection|PoolableConnection的子类,用于包装ManagedConnection,支持JTA和XA事务 +ManagedConnection|用于包装原生的Connection,支持JTA和XA事务 +PoolGuardConnectionWrapper|用于包装PoolableConnection,当accessToUnderlyingConnectionAllowed才能获取底层连接对象。我们获取到的就是这个对象 + + + +### PoolingDataSource.getConnection() +```java + public Connection getConnection() throws SQLException { + // 这个泛型C指的是PoolableConnection对象 + // 调用的是GenericObjectPool的方法返回PoolableConnection对象,这个方法后面会展开 + final C conn = pool.borrowObject(); + if (conn == null) { + return null; + } + // 包装PoolableConnection对象,当accessToUnderlyingConnectionAllowed为true时,可以使用底层连接 + return new PoolGuardConnectionWrapper<>(conn); + } +``` + +### GenericObjectPool.borrowObject() +```java + // 存放着连接池所有的连接对象(但不包含已经释放的) + private final Map, PooledObject> allObjects = + new ConcurrentHashMap<>(); + // 存放着空闲连接对象的阻塞队列 + private final LinkedBlockingDeque> idleObjects; + // 为1表示当前正在创建新连接对象 + private long makeObjectCount = 0; + // 创建连接对象时所用的锁 + private final Object makeObjectCountLock = new Object(); + // 连接对象创建总数量 + private final AtomicLong createCount = new AtomicLong(0); + // 连接对象借出总数量 + private final AtomicLong borrowedCount = new AtomicLong(0); + // 连接对象归还总数量 + private final AtomicLong returnedCount = new AtomicLong(0); + // 连接对象销毁总数量 + final AtomicLong destroyedCount = new AtomicLong(0); + final AtomicLong destroyedByEvictorCount = new AtomicLong(0); + // 三个计时相关对象 + private final StatsStore activeTimes = new StatsStore(MEAN_TIMING_STATS_CACHE_SIZE); + private final StatsStore idleTimes = new StatsStore(MEAN_TIMING_STATS_CACHE_SIZE); + private final StatsStore waitTimes = new StatsStore(MEAN_TIMING_STATS_CACHE_SIZE); + + public T borrowObject() throws Exception { + return borrowObject(getMaxWaitMillis()); + } + + public T borrowObject(final long borrowMaxWaitMillis) throws Exception { + // 校验连接池是否打开状态 + assertOpen(); + + // 如果设置了removeAbandonedOnBorrow,达到触发条件是会遍历所有连接,未使用时长超过removeAbandonedTimeout的将被释放掉 + final AbandonedConfig ac = this.abandonedConfig; + if (ac != null && ac.getRemoveAbandonedOnBorrow() && + (getNumIdle() < 2) && + (getNumActive() > getMaxTotal() - 3) ) { + removeAbandoned(ac); + } + + + PooledObject p = null; + // 连接数达到maxTotal是否阻塞等待 + final boolean blockWhenExhausted = getBlockWhenExhausted(); + + boolean create; + final long waitTime = System.currentTimeMillis(); + + // 如果获取的连接对象为空,会再次进入获取 + while (p == null) { + create = false; + // 获取空闲队列的第一个元素,如果为空就试图创建新连接 + p = idleObjects.pollFirst(); + if (p == null) { + // 后面分析这个方法 + p = create(); + if (p != null) { + create = true; + } + } + // 连接数达到maxTotal需要阻塞等待,会等待空闲队列中连接 + if (blockWhenExhausted) { + if (p == null) { + if (borrowMaxWaitMillis < 0) { + // 无限等待 + p = idleObjects.takeFirst(); + } else { + // 等待maxWaitMillis + p = idleObjects.pollFirst(borrowMaxWaitMillis, + TimeUnit.MILLISECONDS); + } + } + // 这个时候还是没有就会抛出异常 + if (p == null) { + throw new NoSuchElementException( + "Timeout waiting for idle object"); + } + } else { + if (p == null) { + throw new NoSuchElementException("Pool exhausted"); + } + } + // 如果连接处于空闲状态,会修改连接的state、lastBorrowTime、lastUseTime、borrowedCount等,并返回true + if (!p.allocate()) { + p = null; + } + + if (p != null) { + // 利用工厂重新初始化连接对象,这里会去校验连接存活时间、设置lastUsedTime、及其他初始参数 + try { + factory.activateObject(p); + } catch (final Exception e) { + try { + destroy(p); + } catch (final Exception e1) { + // Ignore - activation failure is more important + } + p = null; + if (create) { + final NoSuchElementException nsee = new NoSuchElementException( + "Unable to activate object"); + nsee.initCause(e); + throw nsee; + } + } + // 根据设置的参数,判断是否检测连接有效性 + if (p != null && (getTestOnBorrow() || create && getTestOnCreate())) { + boolean validate = false; + Throwable validationThrowable = null; + try { + // 这里会去校验连接的存活时间是否超过maxConnLifetimeMillis,以及通过SQL去校验执行时间 + validate = factory.validateObject(p); + } catch (final Throwable t) { + PoolUtils.checkRethrow(t); + validationThrowable = t; + } + // 如果校验不通过,会释放该对象 + if (!validate) { + try { + destroy(p); + destroyedByBorrowValidationCount.incrementAndGet(); + } catch (final Exception e) { + // Ignore - validation failure is more important + } + p = null; + if (create) { + final NoSuchElementException nsee = new NoSuchElementException( + "Unable to validate object"); + nsee.initCause(validationThrowable); + throw nsee; + } + } + } + } + } + // 更新borrowedCount、idleTimes和waitTimes + updateStatsBorrow(p, System.currentTimeMillis() - waitTime); + + return p.getObject(); + } +``` +### GenericObjectPool.create() +```java + private PooledObject create() throws Exception { + int localMaxTotal = getMaxTotal(); + if (localMaxTotal < 0) { + localMaxTotal = Integer.MAX_VALUE; + } + + final long localStartTimeMillis = System.currentTimeMillis(); + final long localMaxWaitTimeMillis = Math.max(getMaxWaitMillis(), 0); + + // 创建标识: + // - TRUE: 调用工厂创建返回对象 + // - FALSE: 直接返回null + // - null: 继续循环 + Boolean create = null; + while (create == null) { + synchronized (makeObjectCountLock) { + final long newCreateCount = createCount.incrementAndGet(); + if (newCreateCount > localMaxTotal) { + // 当前池已经达到maxTotal,或者有另外一个线程正在试图创建一个新的连接使之达到容量极限 + createCount.decrementAndGet(); + if (makeObjectCount == 0) { + // 连接池确实已达到容量极限 + create = Boolean.FALSE; + } else { + // 当前另外一个线程正在试图创建一个新的连接使之达到容量极限,此时需要等待 + makeObjectCountLock.wait(localMaxWaitTimeMillis); + } + } else { + // 当前连接池容量未到达极限,可以继续创建连接对象 + makeObjectCount++; + create = Boolean.TRUE; + } + } + + // 当达到maxWaitTimeMillis时不创建连接对象,直接退出循环 + if (create == null && + (localMaxWaitTimeMillis > 0 && + System.currentTimeMillis() - localStartTimeMillis >= localMaxWaitTimeMillis)) { + create = Boolean.FALSE; + } + } + + if (!create.booleanValue()) { + return null; + } + + final PooledObject p; + try { + // 调用工厂创建对象,后面对这个方法展开分析 + p = factory.makeObject(); + } catch (final Throwable e) { + createCount.decrementAndGet(); + throw e; + } finally { + synchronized (makeObjectCountLock) { + // 创建标识-1 + makeObjectCount--; + // 唤醒makeObjectCountLock锁住的对象 + makeObjectCountLock.notifyAll(); + } + } + + final AbandonedConfig ac = this.abandonedConfig; + if (ac != null && ac.getLogAbandoned()) { + p.setLogAbandoned(true); + // TODO: in 3.0, this can use the method defined on PooledObject + if (p instanceof DefaultPooledObject) { + ((DefaultPooledObject) p).setRequireFullStackTrace(ac.getRequireFullStackTrace()); + } + } + // 连接数量+1 + createdCount.incrementAndGet(); + // 将创建的对象放入allObjects + allObjects.put(new IdentityWrapper<>(p.getObject()), p); + return p; + } + +``` + +### PoolableConnectionFactory.makeObject() +```java + public PooledObject makeObject() throws Exception { + // 创建原生的Connection对象 + Connection conn = connectionFactory.createConnection(); + if (conn == null) { + throw new IllegalStateException("Connection factory returned null from createConnection"); + } + try { + // 执行我们设置的connectionInitSqls + initializeConnection(conn); + } catch (final SQLException sqle) { + // Make sure the connection is closed + try { + conn.close(); + } catch (final SQLException ignore) { + // ignore + } + // Rethrow original exception so it is visible to caller + throw sqle; + } + // 连接索引+1 + final long connIndex = connectionIndex.getAndIncrement(); + + // 如果设置了poolPreparedStatements,则创建包装连接为PoolingConnection对象 + if (poolStatements) { + conn = new PoolingConnection(conn); + final GenericKeyedObjectPoolConfig config = new GenericKeyedObjectPoolConfig<>(); + config.setMaxTotalPerKey(-1); + config.setBlockWhenExhausted(false); + config.setMaxWaitMillis(0); + config.setMaxIdlePerKey(1); + config.setMaxTotal(maxOpenPreparedStatements); + if (dataSourceJmxObjectName != null) { + final StringBuilder base = new StringBuilder(dataSourceJmxObjectName.toString()); + base.append(Constants.JMX_CONNECTION_BASE_EXT); + base.append(Long.toString(connIndex)); + config.setJmxNameBase(base.toString()); + config.setJmxNamePrefix(Constants.JMX_STATEMENT_POOL_PREFIX); + } else { + config.setJmxEnabled(false); + } + final PoolingConnection poolingConn = (PoolingConnection) conn; + final KeyedObjectPool stmtPool = new GenericKeyedObjectPool<>( + poolingConn, config); + poolingConn.setStatementPool(stmtPool); + poolingConn.setCacheState(cacheState); + } + + // 用于注册连接到JMX + ObjectName connJmxName; + if (dataSourceJmxObjectName == null) { + connJmxName = null; + } else { + connJmxName = new ObjectName( + dataSourceJmxObjectName.toString() + Constants.JMX_CONNECTION_BASE_EXT + connIndex); + } + + // 创建PoolableConnection对象 + final PoolableConnection pc = new PoolableConnection(conn, pool, connJmxName, disconnectionSqlCodes, + fastFailValidation); + pc.setCacheState(cacheState); + + // 包装成连接池所需的对象 + return new DefaultPooledObject<>(pc); + } +``` + +## 空闲对象回收器Evictor +前面已经讲到当创建完数据源对象时会开启连接池的evictor线程。 + +### BasicDataSource.startPoolMaintenance() +```java + protected void startPoolMaintenance() { + // 只有timeBetweenEvictionRunsMillis为正数,才会开启空闲对象回收器 + if (connectionPool != null && timeBetweenEvictionRunsMillis > 0) { + connectionPool.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); + } + } +``` +### BaseGenericObjectPool.setTimeBetweenEvictionRunsMillis(long) +这个BaseGenericObjectPool是上面说到的GenericObjectPool的父类。 + +```java + public final void setTimeBetweenEvictionRunsMillis( + final long timeBetweenEvictionRunsMillis) { + // 设置回收线程运行间隔时间 + this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis; + // + startEvictor(timeBetweenEvictionRunsMillis); + } +``` + +### BaseGenericObjectPool.startEvictor(long) +```java + final void startEvictor(final long delay) { + synchronized (evictionLock) { + if (null != evictor) { + EvictionTimer.cancel(evictor, evictorShutdownTimeoutMillis, TimeUnit.MILLISECONDS); + evictor = null; + evictionIterator = null; + } + // 创建回收器任务,并执行定时调度 + if (delay > 0) { + evictor = new Evictor(); + EvictionTimer.schedule(evictor, delay, delay); + } + } + } +``` + +### EvictionTimer.schedule(Evictor, long, long) +DBCP是使用ScheduledThreadPoolExecutor来实现回收器的定时检测。 + +```java + static synchronized void schedule( + final BaseGenericObjectPool.Evictor task, final long delay, final long period) + if (null == executor) { + // 创建线程池,队列为DelayedWorkQueue,corePoolSize为1,maximumPoolSize为无限大 + executor = new ScheduledThreadPoolExecutor(1, new EvictorThreadFactory()); + // 当任务被取消的同时从等待队列中移除 + executor.setRemoveOnCancelPolicy(true); + } + // 设置任务定时调度 + final ScheduledFuture scheduledFuture = + executor.scheduleWithFixedDelay(task, delay, period, TimeUnit.MILLISECONDS); + task.setScheduledFuture(scheduledFuture); + } +``` +### BaseGenericObjectPool.Evictor +Evictor是BaseGenericObjectPool的内部类,这里看下它的run方法。 + +```java + class Evictor implements Runnable { + + private ScheduledFuture scheduledFuture; + + @Override + public void run() { + final ClassLoader savedClassLoader = + Thread.currentThread().getContextClassLoader(); + try { + // 确保回收器使用的类加载器和工厂对象的一样 + if (factoryClassLoader != null) { + final ClassLoader cl = factoryClassLoader.get(); + if (cl == null) { + cancel(); + return; + } + Thread.currentThread().setContextClassLoader(cl); + } + + // 回收符合条件的对象 + try { + evict(); + } catch(final Exception e) { + swallowException(e); + } catch(final OutOfMemoryError oome) { + // Log problem but give evictor thread a chance to continue + // in case error is recoverable + oome.printStackTrace(System.err); + } + try { + // 确保最小空闲对象 + ensureMinIdle(); + } catch (final Exception e) { + swallowException(e); + } + } finally { + Thread.currentThread().setContextClassLoader(savedClassLoader); + } + } + + + void setScheduledFuture(final ScheduledFuture scheduledFuture) { + this.scheduledFuture = scheduledFuture; + } + + + void cancel() { + scheduledFuture.cancel(false); + } + } +``` + +### GenericObjectPool.evict() +这里的回收过程包括以下四道校验: + +1. 按照evictionPolicy校验idleSoftEvictTime、idleEvictTime; + +2. 利用工厂重新初始化样本,这里会校验maxConnLifetimeMillis(testWhileIdle为true); + +3. 校验maxConnLifetimeMillis和validationQueryTimeout(testWhileIdle为true); + +4. 校验所有连接的未使用时间是否超过removeAbandonedTimeout(removeAbandonedOnMaintenance为true)。 + +```java + public void evict() throws Exception { + // 校验当前连接池是否关闭 + assertOpen(); + + if (idleObjects.size() > 0) { + + PooledObject underTest = null; + // 介绍参数时已经讲到,这个evictionPolicy我们可以自定义 + final EvictionPolicy evictionPolicy = getEvictionPolicy(); + + synchronized (evictionLock) { + final EvictionConfig evictionConfig = new EvictionConfig( + getMinEvictableIdleTimeMillis(), + getSoftMinEvictableIdleTimeMillis(), + getMinIdle()); + + final boolean testWhileIdle = getTestWhileIdle(); + // 获取我们指定的样本数,并开始遍历 + for (int i = 0, m = getNumTests(); i < m; i++) { + if (evictionIterator == null || !evictionIterator.hasNext()) { + evictionIterator = new EvictionIterator(idleObjects); + } + if (!evictionIterator.hasNext()) { + // Pool exhausted, nothing to do here + return; + } + + try { + underTest = evictionIterator.next(); + } catch (final NoSuchElementException nsee) { + // 当前样本正被另一个线程借出 + i--; + evictionIterator = null; + continue; + } + // 判断如果样本是空闲状态,设置为EVICTION状态 + // 如果不是,说明另一个线程已经借出了这个样本 + if (!underTest.startEvictionTest()) { + i--; + continue; + } + + boolean evict; + try { + // 调用回收策略来判断是否回收该样本,按照默认策略,以下情况都会返回true: + // 1. 样本空闲时间大于我们设置的idleSoftEvictTime,且当前池中空闲连接数量>minIdle + // 2. 样本空闲时间大于我们设置的idleEvictTime + evict = evictionPolicy.evict(evictionConfig, underTest, + idleObjects.size()); + } catch (final Throwable t) { + PoolUtils.checkRethrow(t); + swallowException(new Exception(t)); + evict = false; + } + // 如果需要回收,则释放这个样本 + if (evict) { + destroy(underTest); + destroyedByEvictorCount.incrementAndGet(); + } else { + // 如果设置了testWhileIdle,会 + if (testWhileIdle) { + boolean active = false; + try { + // 利用工厂重新初始化样本,这里会校验maxConnLifetimeMillis + factory.activateObject(underTest); + active = true; + } catch (final Exception e) { + // 抛出异常标识校验不通过,释放样本 + destroy(underTest); + destroyedByEvictorCount.incrementAndGet(); + } + if (active) { + // 接下来会校验maxConnLifetimeMillis和validationQueryTimeout + if (!factory.validateObject(underTest)) { + destroy(underTest); + destroyedByEvictorCount.incrementAndGet(); + } else { + try { + // 这里会将样本rollbackOnReturn、autoCommitOnReturn等 + factory.passivateObject(underTest); + } catch (final Exception e) { + destroy(underTest); + destroyedByEvictorCount.incrementAndGet(); + } + } + } + } + // 如果状态为EVICTION或EVICTION_RETURN_TO_HEAD,修改为IDLE + if (!underTest.endEvictionTest(idleObjects)) { + //空 + } + } + } + } + } + // 校验所有连接的未使用时间是否超过removeAbandonedTimeout + final AbandonedConfig ac = this.abandonedConfig; + if (ac != null && ac.getRemoveAbandonedOnMaintenance()) { + removeAbandoned(ac); + } + } +``` +> 本文为原创文章,转载请附上原文出处链接:https://github.com/ZhangZiSheng001/dbcp-demo。 diff --git a/img/dbcp-Connection.cld b/img/dbcp-Connection.cld new file mode 100644 index 0000000..1fd6310 --- /dev/null +++ b/img/dbcp-Connection.cld @@ -0,0 +1,7779 @@ + + + + 255 + 255 + 206 + + + 0 + 0 + 0 + + true + + + + + 2 + + + + + + + + + + + true + + + + + + 2 + + + + + + -1 + -1 + 541 + 742 + + + + + true + + + + + 2 + + + + + + + + true + + + + + + 2 + + + + + + -1 + -1 + 436 + 677 + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + + + true + + + + + 2 + + + + + + + + true + + + + + + 2 + + + + + + -1 + -1 + 45 + 588 + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + + + + + + true + + + + + + 2 + + + + + + accessToUnderlyingConnectionAllowed + boolean + false + + + + + true + + + + + + 2 + + + + + + pooledConnection + org.apache.commons.dbcp2.cpdsadapter.PooledConnectionImpl + false + + + + + true + + + + + + 2 + + + + + + ConnectionImpl + void + + + pooledConnection + org.apache.commons.dbcp2.cpdsadapter.PooledConnectionImpl + + + connection + java.sql.Connection + + + accessToUnderlyingConnectionAllowed + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + close + void + + false + false + + + + + true + + + + + + 2 + + + + + + prepareCall + java.sql.CallableStatement + + + sql + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareCall + java.sql.CallableStatement + + + sql + java.lang.String + + + resultSetType + int + + + resultSetConcurrency + int + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareCall + java.sql.CallableStatement + + + sql + java.lang.String + + + resultSetType + int + + + resultSetConcurrency + int + + + resultSetHoldability + int + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + resultSetType + int + + + resultSetConcurrency + int + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + resultSetType + int + + + resultSetConcurrency + int + + + resultSetHoldability + int + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + autoGeneratedKeys + int + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + columnIndexes + int[] + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + columnNames + java.lang.String[] + + + false + false + + + + + true + + + + + + 2 + + + + + + isAccessToUnderlyingConnectionAllowed + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + getDelegate + java.sql.Connection + + false + false + + + + + true + + + + + + 2 + + + + + + getInnermostDelegate + java.sql.Connection + + false + false + + + + + operationpackage + true + + + operationpublic + true + + + attrpublic + true + + + attrprotected + true + + + attrpackage + true + + + operationprivate + true + + + attrprivate + true + + + operationprotected + true + + + + + _stereo_type + Stereo Type + false + + + _simpleEntityName + Simple Name + false + + + _entityName + Name + false + + + _background + Background Color + false + + + _attrs + Attributes... + false + + + _operations + Operations... + false + + + _abstract + abstract + false + + + + org.apache.commons.dbcp2.cpdsadapter.ConnectionImpl + false + + + + + + true + + + + + 2 + + + + + + + + true + + + + + + 2 + + + + + + -1 + -1 + 916 + 579 + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + + + + + + true + + + + + + 2 + + + + + + pool + org.apache.commons.pool2.ObjectPool<C> + false + + + + + true + + + + + + 2 + + + + + + transactionRegistry + org.apache.commons.dbcp2.managed.TransactionRegistry + false + + + + + true + + + + + + 2 + + + + + + accessToUnderlyingConnectionAllowed + boolean + false + + + + + true + + + + + + 2 + + + + + + transactionContext + org.apache.commons.dbcp2.managed.TransactionContext + false + + + + + true + + + + + + 2 + + + + + + isSharedConnection + boolean + false + + + + + true + + + + + + 2 + + + + + + lock + java.util.concurrent.locks.Lock + false + + + + + true + + + + + + 2 + + + + + + ManagedConnection + void + + + pool + org.apache.commons.pool2.ObjectPool<C> + + + transactionRegistry + org.apache.commons.dbcp2.managed.TransactionRegistry + + + accessToUnderlyingConnectionAllowed + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + checkOpen + void + + false + false + + + + + true + + + + + + 2 + + + + + + close + void + + false + false + + + + + true + + + + + + 2 + + + + + + commit + void + + false + false + + + + + true + + + + + + 2 + + + + + + getDelegate + C + + false + false + + + + + true + + + + + + 2 + + + + + + getInnermostDelegate + java.sql.Connection + + false + false + + + + + true + + + + + + 2 + + + + + + getTransactionContext + org.apache.commons.dbcp2.managed.TransactionContext + + false + false + + + + + true + + + + + + 2 + + + + + + getTransactionRegistry + org.apache.commons.dbcp2.managed.TransactionRegistry + + false + false + + + + + true + + + + + + 2 + + + + + + isAccessToUnderlyingConnectionAllowed + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + rollback + void + + false + false + + + + + true + + + + + + 2 + + + + + + setAutoCommit + void + + + autoCommit + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setReadOnly + void + + + readOnly + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + transactionComplete + void + + false + false + + + + + true + + + + + + 2 + + + + + + updateTransactionStatus + void + + false + false + + + + + true + + + + + + 2 + + + + + + access$000 + org.apache.commons.dbcp2.managed.TransactionContext + + + arg0 + org.apache.commons.dbcp2.managed.ManagedConnection + + + false + true + + + + + operationpackage + true + + + operationpublic + true + + + attrpublic + true + + + attrprotected + true + + + attrpackage + true + + + operationprivate + true + + + attrprivate + true + + + operationprotected + true + + + + + _stereo_type + Stereo Type + false + + + _simpleEntityName + Simple Name + false + + + _entityName + Name + false + + + _background + Background Color + false + + + _attrs + Attributes... + false + + + _operations + Operations... + false + + + _abstract + abstract + false + + + + org.apache.commons.dbcp2.managed.ManagedConnection + false + + + + + + + + + true + + + + + 2 + + + + + + + + true + + + + + + 2 + + + + + + -1 + -1 + 163 + 490 + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + + + true + + + + + 2 + + + + + + + + true + + + + + + 2 + + + + + + -1 + -1 + 59 + 293 + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + + + + + + true + + + + + + 2 + + + + + + transactionRegistry + org.apache.commons.dbcp2.managed.TransactionRegistry + false + + + + + true + + + + + + 2 + + + + + + PoolableManagedConnection + void + + + transactionRegistry + org.apache.commons.dbcp2.managed.TransactionRegistry + + + conn + java.sql.Connection + + + pool + org.apache.commons.pool2.ObjectPool<org.apache.commons.dbcp2.PoolableConnection> + + + false + false + + + + + true + + + + + + 2 + + + + + + PoolableManagedConnection + void + + + transactionRegistry + org.apache.commons.dbcp2.managed.TransactionRegistry + + + conn + java.sql.Connection + + + pool + org.apache.commons.pool2.ObjectPool<org.apache.commons.dbcp2.PoolableConnection> + + + disconnectSqlCodes + java.util.Collection<java.lang.String> + + + fastFailValidation + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + getTransactionRegistry + org.apache.commons.dbcp2.managed.TransactionRegistry + + false + false + + + + + true + + + + + + 2 + + + + + + reallyClose + void + + false + false + + + + + operationpackage + true + + + operationpublic + true + + + attrprotected + true + + + attrpackage + true + + + operationprivate + true + + + attrprivate + true + + + operationprotected + true + + + + + _stereo_type + Stereo Type + false + + + _simpleEntityName + Simple Name + false + + + _entityName + Name + false + + + _background + Background Color + false + + + _attrs + Attributes... + false + + + _operations + Operations... + false + + + _abstract + abstract + false + + + + org.apache.commons.dbcp2.managed.PoolableManagedConnection + false + + + + + + + + + + + + true + + + + + + 2 + + + + + + MBEAN_SERVER + javax.management.MBeanServer + true + + + + + true + + + + + + 2 + + + + + + pool + org.apache.commons.pool2.ObjectPool<org.apache.commons.dbcp2.PoolableConnection> + false + + + + + true + + + + + + 2 + + + + + + jmxObjectName + org.apache.commons.dbcp2.ObjectNameWrapper + false + + + + + true + + + + + + 2 + + + + + + validationPreparedStatement + java.sql.PreparedStatement + false + + + + + true + + + + + + 2 + + + + + + lastValidationSql + java.lang.String + false + + + + + true + + + + + + 2 + + + + + + fatalSqlExceptionThrown + boolean + false + + + + + true + + + + + + 2 + + + + + + disconnectionSqlCodes + java.util.Collection<java.lang.String> + false + + + + + true + + + + + + 2 + + + + + + fastFailValidation + boolean + false + + + + + true + + + + + + 2 + + + + + + PoolableConnection + void + + + conn + java.sql.Connection + + + pool + org.apache.commons.pool2.ObjectPool<org.apache.commons.dbcp2.PoolableConnection> + + + jmxObjectName + javax.management.ObjectName + + + disconnectSqlCodes + java.util.Collection<java.lang.String> + + + fastFailValidation + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + PoolableConnection + void + + + conn + java.sql.Connection + + + pool + org.apache.commons.pool2.ObjectPool<org.apache.commons.dbcp2.PoolableConnection> + + + jmxName + javax.management.ObjectName + + + false + false + + + + + true + + + + + + 2 + + + + + + passivate + void + + false + false + + + + + true + + + + + + 2 + + + + + + isClosed + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + close + void + + false + false + + + + + true + + + + + + 2 + + + + + + reallyClose + void + + false + false + + + + + true + + + + + + 2 + + + + + + getToString + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + validate + void + + + sql + java.lang.String + + + timeoutSeconds + int + + + false + false + + + + + true + + + + + + 2 + + + + + + isDisconnectionSqlException + boolean + + + e + java.sql.SQLException + + + false + false + + + + + true + + + + + + 2 + + + + + + handleException + void + + + e + java.sql.SQLException + + + false + false + + + + + true + + + + + + 2 + + + + + + getDisconnectionSqlCodes + java.util.Collection<java.lang.String> + + false + false + + + + + true + + + + + + 2 + + + + + + isFastFailValidation + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + <clinit> + void + + false + true + + + + + operationpackage + true + + + operationpublic + true + + + attrpublic + true + + + attrprotected + true + + + attrpackage + true + + + operationprivate + true + + + attrprivate + true + + + operationprotected + true + + + + + _stereo_type + Stereo Type + false + + + _simpleEntityName + Simple Name + false + + + _entityName + Name + false + + + _background + Background Color + false + + + _attrs + Attributes... + false + + + _operations + Operations... + false + + + _abstract + abstract + false + + + + org.apache.commons.dbcp2.PoolableConnection + false + + + + + + + + true + + + + + 2 + + + + + + + + true + + + + + + 2 + + + + + + -1 + -1 + 585 + 415 + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + + + + + + true + + + + + + 2 + + + + + + this$0 + org.apache.commons.dbcp2.PoolingDataSource + false + + + + + true + + + + + + 2 + + + + + + PoolGuardConnectionWrapper + void + + + delegate + org.apache.commons.dbcp2.PoolingDataSource + + + false + false + + + + + true + + + + + + 2 + + + + + + getDelegate + D + + false + false + + + + + true + + + + + + 2 + + + + + + getInnermostDelegate + java.sql.Connection + + false + false + + + + + true + + + + + + 2 + + + + + + close + void + + false + false + + + + + true + + + + + + 2 + + + + + + isClosed + boolean + + false + false + + + + + operationpackage + true + + + operationpublic + true + + + attrpublic + true + + + attrprotected + true + + + attrpackage + true + + + operationprivate + true + + + attrprivate + true + + + operationprotected + true + + + + + _stereo_type + Stereo Type + false + + + _simpleEntityName + Simple Name + false + + + _entityName + Name + false + + + _background + Background Color + false + + + _attrs + Attributes... + false + + + _operations + Operations... + false + + + _abstract + abstract + false + + + + org.apache.commons.dbcp2.PoolingDataSource.PoolGuardConnectionWrapper + false + + + + + + + + + + + + + true + + + + + 2 + + + + + + + + true + + + + + + 2 + + + + + + -1 + -1 + 860 + 505 + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + + + + + + true + + + + + + 2 + + + + + + pstmtPool + org.apache.commons.pool2.KeyedObjectPool<org.apache.commons.dbcp2.PStmtKey,org.apache.commons.dbcp2.DelegatingPreparedStatement> + false + + + + + true + + + + + + 2 + + + + + + PoolingConnection + void + + + connection + java.sql.Connection + + + false + false + + + + + true + + + + + + 2 + + + + + + activateObject + void + + + key + org.apache.commons.dbcp2.PStmtKey + + + pooledObject + org.apache.commons.pool2.PooledObject<org.apache.commons.dbcp2.DelegatingPreparedStatement> + + + false + false + + + + + true + + + + + + 2 + + + + + + close + void + + false + false + + + + + true + + + + + + 2 + + + + + + createKey + org.apache.commons.dbcp2.PStmtKey + + + sql + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + createKey + org.apache.commons.dbcp2.PStmtKey + + + sql + java.lang.String + + + columnIndexes + int[] + + + false + false + + + + + true + + + + + + 2 + + + + + + createKey + org.apache.commons.dbcp2.PStmtKey + + + sql + java.lang.String + + + autoGeneratedKeys + int + + + false + false + + + + + true + + + + + + 2 + + + + + + createKey + org.apache.commons.dbcp2.PStmtKey + + + sql + java.lang.String + + + resultSetType + int + + + resultSetConcurrency + int + + + false + false + + + + + true + + + + + + 2 + + + + + + createKey + org.apache.commons.dbcp2.PStmtKey + + + sql + java.lang.String + + + resultSetType + int + + + resultSetConcurrency + int + + + resultSetHoldability + int + + + false + false + + + + + true + + + + + + 2 + + + + + + createKey + org.apache.commons.dbcp2.PStmtKey + + + sql + java.lang.String + + + resultSetType + int + + + resultSetConcurrency + int + + + resultSetHoldability + int + + + statementType + org.apache.commons.dbcp2.PoolingConnection.StatementType + + + false + false + + + + + true + + + + + + 2 + + + + + + createKey + org.apache.commons.dbcp2.PStmtKey + + + sql + java.lang.String + + + resultSetType + int + + + resultSetConcurrency + int + + + statementType + org.apache.commons.dbcp2.PoolingConnection.StatementType + + + false + false + + + + + true + + + + + + 2 + + + + + + createKey + org.apache.commons.dbcp2.PStmtKey + + + sql + java.lang.String + + + statementType + org.apache.commons.dbcp2.PoolingConnection.StatementType + + + false + false + + + + + true + + + + + + 2 + + + + + + createKey + org.apache.commons.dbcp2.PStmtKey + + + sql + java.lang.String + + + columnNames + java.lang.String[] + + + false + false + + + + + true + + + + + + 2 + + + + + + destroyObject + void + + + key + org.apache.commons.dbcp2.PStmtKey + + + pooledObject + org.apache.commons.pool2.PooledObject<org.apache.commons.dbcp2.DelegatingPreparedStatement> + + + false + false + + + + + true + + + + + + 2 + + + + + + getCatalogOrNull + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + getSchemaOrNull + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + makeObject + org.apache.commons.pool2.PooledObject<org.apache.commons.dbcp2.DelegatingPreparedStatement> + + + key + org.apache.commons.dbcp2.PStmtKey + + + false + false + + + + + true + + + + + + 2 + + + + + + normalizeSQL + java.lang.String + + + sql + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + passivateObject + void + + + key + org.apache.commons.dbcp2.PStmtKey + + + pooledObject + org.apache.commons.pool2.PooledObject<org.apache.commons.dbcp2.DelegatingPreparedStatement> + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareCall + java.sql.CallableStatement + + + sql + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareCall + java.sql.CallableStatement + + + sql + java.lang.String + + + resultSetType + int + + + resultSetConcurrency + int + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareCall + java.sql.CallableStatement + + + sql + java.lang.String + + + resultSetType + int + + + resultSetConcurrency + int + + + resultSetHoldability + int + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + autoGeneratedKeys + int + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + columnIndexes + int[] + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + resultSetType + int + + + resultSetConcurrency + int + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + resultSetType + int + + + resultSetConcurrency + int + + + resultSetHoldability + int + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + columnNames + java.lang.String[] + + + false + false + + + + + true + + + + + + 2 + + + + + + setStatementPool + void + + + pool + org.apache.commons.pool2.KeyedObjectPool<org.apache.commons.dbcp2.PStmtKey,org.apache.commons.dbcp2.DelegatingPreparedStatement> + + + false + false + + + + + true + + + + + + 2 + + + + + + toString + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + validateObject + boolean + + + key + org.apache.commons.dbcp2.PStmtKey + + + pooledObject + org.apache.commons.pool2.PooledObject<org.apache.commons.dbcp2.DelegatingPreparedStatement> + + + false + false + + + + + true + + + + + + 2 + + + + + + passivateObject + void + + + arg0 + java.lang.Object + + + arg1 + org.apache.commons.pool2.PooledObject + + + false + false + + + + + true + + + + + + 2 + + + + + + activateObject + void + + + arg0 + java.lang.Object + + + arg1 + org.apache.commons.pool2.PooledObject + + + false + false + + + + + true + + + + + + 2 + + + + + + validateObject + boolean + + + arg0 + java.lang.Object + + + arg1 + org.apache.commons.pool2.PooledObject + + + false + false + + + + + true + + + + + + 2 + + + + + + destroyObject + void + + + arg0 + java.lang.Object + + + arg1 + org.apache.commons.pool2.PooledObject + + + false + false + + + + + true + + + + + + 2 + + + + + + makeObject + org.apache.commons.pool2.PooledObject + + + arg0 + java.lang.Object + + + false + false + + + + + operationpackage + true + + + operationpublic + true + + + attrpublic + true + + + attrprotected + true + + + attrpackage + true + + + operationprivate + true + + + attrprivate + true + + + operationprotected + true + + + + + _stereo_type + Stereo Type + false + + + _simpleEntityName + Simple Name + false + + + _entityName + Name + false + + + _background + Background Color + false + + + _attrs + Attributes... + false + + + _operations + Operations... + false + + + _abstract + abstract + false + + + + org.apache.commons.dbcp2.PoolingConnection + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + 2 + + + + + + EMPTY_FAILED_PROPERTIES + java.util.Map<java.lang.String,java.sql.ClientInfoStatus> + true + + + + + true + + + + + + 2 + + + + + + connection + C + false + + + + + true + + + + + + 2 + + + + + + closed + boolean + false + + + + + true + + + + + + 2 + + + + + + cacheState + boolean + false + + + + + true + + + + + + 2 + + + + + + autoCommitCached + java.lang.Boolean + false + + + + + true + + + + + + 2 + + + + + + readOnlyCached + java.lang.Boolean + false + + + + + true + + + + + + 2 + + + + + + defaultQueryTimeoutSeconds + java.lang.Integer + false + + + + + true + + + + + + 2 + + + + + + DelegatingConnection + void + + + c + C + + + false + false + + + + + true + + + + + + 2 + + + + + + toString + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + getDelegate + C + + false + false + + + + + true + + + + + + 2 + + + + + + getDelegateInternal + C + + false + false + + + + + true + + + + + + 2 + + + + + + innermostDelegateEquals + boolean + + + c + java.sql.Connection + + + false + false + + + + + true + + + + + + 2 + + + + + + getInnermostDelegate + java.sql.Connection + + false + false + + + + + true + + + + + + 2 + + + + + + getInnermostDelegateInternal + java.sql.Connection + + false + false + + + + + true + + + + + + 2 + + + + + + setDelegate + void + + + connection + C + + + false + false + + + + + true + + + + + + 2 + + + + + + close + void + + false + false + + + + + true + + + + + + 2 + + + + + + isClosedInternal + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + setClosedInternal + void + + + closed + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + closeInternal + void + + false + false + + + + + true + + + + + + 2 + + + + + + handleException + void + + + e + java.sql.SQLException + + + false + false + + + + + true + + + + + + 2 + + + + + + initializeStatement + void + + + ds + org.apache.commons.dbcp2.DelegatingStatement + + + false + false + + + + + true + + + + + + 2 + + + + + + createStatement + java.sql.Statement + + false + false + + + + + true + + + + + + 2 + + + + + + createStatement + java.sql.Statement + + + resultSetType + int + + + resultSetConcurrency + int + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + resultSetType + int + + + resultSetConcurrency + int + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareCall + java.sql.CallableStatement + + + sql + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareCall + java.sql.CallableStatement + + + sql + java.lang.String + + + resultSetType + int + + + resultSetConcurrency + int + + + false + false + + + + + true + + + + + + 2 + + + + + + clearWarnings + void + + false + false + + + + + true + + + + + + 2 + + + + + + commit + void + + false + false + + + + + true + + + + + + 2 + + + + + + getCacheState + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + getAutoCommit + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + getCatalog + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + getMetaData + java.sql.DatabaseMetaData + + false + false + + + + + true + + + + + + 2 + + + + + + getTransactionIsolation + int + + false + false + + + + + true + + + + + + 2 + + + + + + getTypeMap + java.util.Map<java.lang.String,java.lang.Class<?>> + + false + false + + + + + true + + + + + + 2 + + + + + + getWarnings + java.sql.SQLWarning + + false + false + + + + + true + + + + + + 2 + + + + + + isReadOnly + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + nativeSQL + java.lang.String + + + sql + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + rollback + void + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultQueryTimeout + java.lang.Integer + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultQueryTimeout + void + + + defaultQueryTimeoutSeconds + java.lang.Integer + + + false + false + + + + + true + + + + + + 2 + + + + + + setCacheState + void + + + cacheState + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + clearCachedState + void + + false + false + + + + + true + + + + + + 2 + + + + + + setAutoCommit + void + + + autoCommit + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setCatalog + void + + + catalog + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + setReadOnly + void + + + readOnly + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setTransactionIsolation + void + + + level + int + + + false + false + + + + + true + + + + + + 2 + + + + + + setTypeMap + void + + + map + java.util.Map<java.lang.String,java.lang.Class<?>> + + + false + false + + + + + true + + + + + + 2 + + + + + + isClosed + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + checkOpen + void + + false + false + + + + + true + + + + + + 2 + + + + + + activate + void + + false + false + + + + + true + + + + + + 2 + + + + + + passivate + void + + false + false + + + + + true + + + + + + 2 + + + + + + getHoldability + int + + false + false + + + + + true + + + + + + 2 + + + + + + setHoldability + void + + + holdability + int + + + false + false + + + + + true + + + + + + 2 + + + + + + setSavepoint + java.sql.Savepoint + + false + false + + + + + true + + + + + + 2 + + + + + + setSavepoint + java.sql.Savepoint + + + name + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + rollback + void + + + savepoint + java.sql.Savepoint + + + false + false + + + + + true + + + + + + 2 + + + + + + releaseSavepoint + void + + + savepoint + java.sql.Savepoint + + + false + false + + + + + true + + + + + + 2 + + + + + + createStatement + java.sql.Statement + + + resultSetType + int + + + resultSetConcurrency + int + + + resultSetHoldability + int + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + resultSetType + int + + + resultSetConcurrency + int + + + resultSetHoldability + int + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareCall + java.sql.CallableStatement + + + sql + java.lang.String + + + resultSetType + int + + + resultSetConcurrency + int + + + resultSetHoldability + int + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + autoGeneratedKeys + int + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + columnIndexes + int[] + + + false + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + columnNames + java.lang.String[] + + + false + false + + + + + true + + + + + + 2 + + + + + + isWrapperFor + boolean + + + iface + java.lang.Class<?> + + + false + false + + + + + true + + + + + + 2 + + + + + + unwrap + T + + + iface + java.lang.Class<T> + + + false + false + + + + + true + + + + + + 2 + + + + + + createArrayOf + java.sql.Array + + + typeName + java.lang.String + + + elements + java.lang.Object[] + + + false + false + + + + + true + + + + + + 2 + + + + + + createBlob + java.sql.Blob + + false + false + + + + + true + + + + + + 2 + + + + + + createClob + java.sql.Clob + + false + false + + + + + true + + + + + + 2 + + + + + + createNClob + java.sql.NClob + + false + false + + + + + true + + + + + + 2 + + + + + + createSQLXML + java.sql.SQLXML + + false + false + + + + + true + + + + + + 2 + + + + + + createStruct + java.sql.Struct + + + typeName + java.lang.String + + + attributes + java.lang.Object[] + + + false + false + + + + + true + + + + + + 2 + + + + + + isValid + boolean + + + timeoutSeconds + int + + + false + false + + + + + true + + + + + + 2 + + + + + + setClientInfo + void + + + name + java.lang.String + + + value + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + setClientInfo + void + + + properties + java.util.Properties + + + false + false + + + + + true + + + + + + 2 + + + + + + getClientInfo + java.util.Properties + + false + false + + + + + true + + + + + + 2 + + + + + + getClientInfo + java.lang.String + + + name + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + setSchema + void + + + schema + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getSchema + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + abort + void + + + executor + java.util.concurrent.Executor + + + false + false + + + + + true + + + + + + 2 + + + + + + setNetworkTimeout + void + + + executor + java.util.concurrent.Executor + + + milliseconds + int + + + false + false + + + + + true + + + + + + 2 + + + + + + getNetworkTimeout + int + + false + false + + + + + true + + + + + + 2 + + + + + + <clinit> + void + + false + true + + + + + operationpackage + true + + + operationpublic + true + + + attrpublic + true + + + attrprotected + true + + + attrpackage + true + + + operationprivate + true + + + attrprivate + true + + + operationprotected + true + + + + + _stereo_type + Stereo Type + false + + + _simpleEntityName + Simple Name + false + + + _entityName + Name + false + + + _background + Background Color + false + + + _attrs + Attributes... + false + + + _operations + Operations... + false + + + _abstract + abstract + false + + + + org.apache.commons.dbcp2.DelegatingConnection + false + + + + + + + + + + + + + + + + + + + + true + + + + + + 2 + + + + + + TRANSACTION_NONE + int + true + + + + + true + + + + + + 2 + + + + + + TRANSACTION_READ_UNCOMMITTED + int + true + + + + + true + + + + + + 2 + + + + + + TRANSACTION_READ_COMMITTED + int + true + + + + + true + + + + + + 2 + + + + + + TRANSACTION_REPEATABLE_READ + int + true + + + + + true + + + + + + 2 + + + + + + TRANSACTION_SERIALIZABLE + int + true + + + + + true + + + + + + 2 + + + + + + createStatement + java.sql.Statement + + true + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + true + false + + + + + true + + + + + + 2 + + + + + + prepareCall + java.sql.CallableStatement + + + sql + java.lang.String + + + true + false + + + + + true + + + + + + 2 + + + + + + nativeSQL + java.lang.String + + + sql + java.lang.String + + + true + false + + + + + true + + + + + + 2 + + + + + + setAutoCommit + void + + + autoCommit + boolean + + + true + false + + + + + true + + + + + + 2 + + + + + + getAutoCommit + boolean + + true + false + + + + + true + + + + + + 2 + + + + + + commit + void + + true + false + + + + + true + + + + + + 2 + + + + + + rollback + void + + true + false + + + + + true + + + + + + 2 + + + + + + close + void + + true + false + + + + + true + + + + + + 2 + + + + + + isClosed + boolean + + true + false + + + + + true + + + + + + 2 + + + + + + getMetaData + java.sql.DatabaseMetaData + + true + false + + + + + true + + + + + + 2 + + + + + + setReadOnly + void + + + readOnly + boolean + + + true + false + + + + + true + + + + + + 2 + + + + + + isReadOnly + boolean + + true + false + + + + + true + + + + + + 2 + + + + + + setCatalog + void + + + catalog + java.lang.String + + + true + false + + + + + true + + + + + + 2 + + + + + + getCatalog + java.lang.String + + true + false + + + + + true + + + + + + 2 + + + + + + setTransactionIsolation + void + + + level + int + + + true + false + + + + + true + + + + + + 2 + + + + + + getTransactionIsolation + int + + true + false + + + + + true + + + + + + 2 + + + + + + getWarnings + java.sql.SQLWarning + + true + false + + + + + true + + + + + + 2 + + + + + + clearWarnings + void + + true + false + + + + + true + + + + + + 2 + + + + + + createStatement + java.sql.Statement + + + resultSetType + int + + + resultSetConcurrency + int + + + true + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + resultSetType + int + + + resultSetConcurrency + int + + + true + false + + + + + true + + + + + + 2 + + + + + + prepareCall + java.sql.CallableStatement + + + sql + java.lang.String + + + resultSetType + int + + + resultSetConcurrency + int + + + true + false + + + + + true + + + + + + 2 + + + + + + getTypeMap + java.util.Map<java.lang.String,java.lang.Class<?>> + + true + false + + + + + true + + + + + + 2 + + + + + + setTypeMap + void + + + map + java.util.Map<java.lang.String,java.lang.Class<?>> + + + true + false + + + + + true + + + + + + 2 + + + + + + setHoldability + void + + + holdability + int + + + true + false + + + + + true + + + + + + 2 + + + + + + getHoldability + int + + true + false + + + + + true + + + + + + 2 + + + + + + setSavepoint + java.sql.Savepoint + + true + false + + + + + true + + + + + + 2 + + + + + + setSavepoint + java.sql.Savepoint + + + name + java.lang.String + + + true + false + + + + + true + + + + + + 2 + + + + + + rollback + void + + + savepoint + java.sql.Savepoint + + + true + false + + + + + true + + + + + + 2 + + + + + + releaseSavepoint + void + + + savepoint + java.sql.Savepoint + + + true + false + + + + + true + + + + + + 2 + + + + + + createStatement + java.sql.Statement + + + resultSetType + int + + + resultSetConcurrency + int + + + resultSetHoldability + int + + + true + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + resultSetType + int + + + resultSetConcurrency + int + + + resultSetHoldability + int + + + true + false + + + + + true + + + + + + 2 + + + + + + prepareCall + java.sql.CallableStatement + + + sql + java.lang.String + + + resultSetType + int + + + resultSetConcurrency + int + + + resultSetHoldability + int + + + true + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + autoGeneratedKeys + int + + + true + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + columnIndexes + int[] + + + true + false + + + + + true + + + + + + 2 + + + + + + prepareStatement + java.sql.PreparedStatement + + + sql + java.lang.String + + + columnNames + java.lang.String[] + + + true + false + + + + + true + + + + + + 2 + + + + + + createClob + java.sql.Clob + + true + false + + + + + true + + + + + + 2 + + + + + + createBlob + java.sql.Blob + + true + false + + + + + true + + + + + + 2 + + + + + + createNClob + java.sql.NClob + + true + false + + + + + true + + + + + + 2 + + + + + + createSQLXML + java.sql.SQLXML + + true + false + + + + + true + + + + + + 2 + + + + + + isValid + boolean + + + timeout + int + + + true + false + + + + + true + + + + + + 2 + + + + + + setClientInfo + void + + + name + java.lang.String + + + value + java.lang.String + + + true + false + + + + + true + + + + + + 2 + + + + + + setClientInfo + void + + + properties + java.util.Properties + + + true + false + + + + + true + + + + + + 2 + + + + + + getClientInfo + java.lang.String + + + name + java.lang.String + + + true + false + + + + + true + + + + + + 2 + + + + + + getClientInfo + java.util.Properties + + true + false + + + + + true + + + + + + 2 + + + + + + createArrayOf + java.sql.Array + + + typeName + java.lang.String + + + elements + java.lang.Object[] + + + true + false + + + + + true + + + + + + 2 + + + + + + createStruct + java.sql.Struct + + + typeName + java.lang.String + + + attributes + java.lang.Object[] + + + true + false + + + + + true + + + + + + 2 + + + + + + setSchema + void + + + schema + java.lang.String + + + true + false + + + + + true + + + + + + 2 + + + + + + getSchema + java.lang.String + + true + false + + + + + true + + + + + + 2 + + + + + + abort + void + + + executor + java.util.concurrent.Executor + + + true + false + + + + + true + + + + + + 2 + + + + + + setNetworkTimeout + void + + + executor + java.util.concurrent.Executor + + + milliseconds + int + + + true + false + + + + + true + + + + + + 2 + + + + + + getNetworkTimeout + int + + true + false + + + + + operationpackage + true + + + operationpublic + true + + + attrpublic + true + + + attrprotected + true + + + attrpackage + true + + + operationprivate + true + + + attrprivate + true + + + operationprotected + true + + + + + _stereo_type + Stereo Type + false + + + _simpleEntityName + Simple Name + false + + + _entityName + Name + false + + + _background + Background Color + false + + + _attrs + Attributes... + false + + + _operations + Operations... + false + + + + java.sql.Connection + + + + + + + + + + + + operationpackage + true + + + operationpublic + true + + + attrpublic + true + + + attrprotected + true + + + attrpackage + true + + + operationprivate + true + + + attrprivate + true + + + operationprotected + true + + + \ No newline at end of file diff --git a/img/dbcp-dataSource.cld b/img/dbcp-dataSource.cld new file mode 100644 index 0000000..373f87f --- /dev/null +++ b/img/dbcp-dataSource.cld @@ -0,0 +1,11772 @@ + + + + 255 + 255 + 206 + + + 0 + 0 + 0 + + true + + + + + 2 + + + + + + + + + + + true + + + + + + 2 + + + + + + -1 + -1 + 1140 + 655 + + + + true + + + + + 2 + + + + + + + + + true + + + + + + 2 + + + + + + -1 + -1 + 1489 + 565 + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + + + + true + + + + + 2 + + + + + + + + + + + + + true + + + + + 2 + + + + + + + + + + + + + true + + + + + 2 + + + + + + + + + + + + + true + + + + + 2 + + + + + + + + + + + + + true + + + + + 2 + + + + + + + + true + + + + + + 2 + + + + + + -1 + -1 + 1376 + 375 + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + + + + + + true + + + + + + 2 + + + + + + transactionRegistry + org.apache.commons.dbcp2.managed.TransactionRegistry + false + + + + + true + + + + + + 2 + + + + + + transactionManager + javax.transaction.TransactionManager + false + + + + + true + + + + + + 2 + + + + + + xaDataSource + java.lang.String + false + + + + + true + + + + + + 2 + + + + + + xaDataSourceInstance + javax.sql.XADataSource + false + + + + + true + + + + + + 2 + + + + + + transactionSynchronizationRegistry + javax.transaction.TransactionSynchronizationRegistry + false + + + + + true + + + + + + 2 + + + + + + BasicManagedDataSource + void + + false + false + + + + + true + + + + + + 2 + + + + + + getXaDataSourceInstance + javax.sql.XADataSource + + false + false + + + + + true + + + + + + 2 + + + + + + setXaDataSourceInstance + void + + + xaDataSourceInstance + javax.sql.XADataSource + + + false + false + + + + + true + + + + + + 2 + + + + + + getTransactionManager + javax.transaction.TransactionManager + + false + false + + + + + true + + + + + + 2 + + + + + + getTransactionSynchronizationRegistry + javax.transaction.TransactionSynchronizationRegistry + + false + false + + + + + true + + + + + + 2 + + + + + + getTransactionRegistry + org.apache.commons.dbcp2.managed.TransactionRegistry + + false + false + + + + + true + + + + + + 2 + + + + + + setTransactionManager + void + + + transactionManager + javax.transaction.TransactionManager + + + false + false + + + + + true + + + + + + 2 + + + + + + setTransactionSynchronizationRegistry + void + + + transactionSynchronizationRegistry + javax.transaction.TransactionSynchronizationRegistry + + + false + false + + + + + true + + + + + + 2 + + + + + + getXADataSource + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + setXADataSource + void + + + xaDataSource + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + createConnectionFactory + org.apache.commons.dbcp2.ConnectionFactory + + false + false + + + + + true + + + + + + 2 + + + + + + createDataSourceInstance + javax.sql.DataSource + + false + false + + + + + true + + + + + + 2 + + + + + + createPoolableConnectionFactory + org.apache.commons.dbcp2.PoolableConnectionFactory + + + driverConnectionFactory + org.apache.commons.dbcp2.ConnectionFactory + + + false + false + + + + + operationpackage + true + + + operationpublic + true + + + attrpublic + true + + + attrprotected + true + + + attrpackage + true + + + operationprivate + true + + + attrprivate + true + + + operationprotected + true + + + + + _stereo_type + Stereo Type + false + + + _simpleEntityName + Simple Name + false + + + _entityName + Name + false + + + _background + Background Color + false + + + _attrs + Attributes... + false + + + _operations + Operations... + false + + + _abstract + abstract + false + + + + org.apache.commons.dbcp2.managed.BasicManagedDataSource + false + + + + + + true + + + + + 2 + + + + + + + + + + + + + true + + + + + 2 + + + + + + + + + + + + + + true + + + + + 2 + + + + + + + + + + + + + + + + + + + true + + + + + + 2 + + + + + + log + org.apache.commons.logging.Log + true + + + + + true + + + + + + 2 + + + + + + defaultAutoCommit + java.lang.Boolean + false + + + + + true + + + + + + 2 + + + + + + defaultReadOnly + java.lang.Boolean + false + + + + + true + + + + + + 2 + + + + + + defaultTransactionIsolation + int + false + + + + + true + + + + + + 2 + + + + + + defaultQueryTimeoutSeconds + java.lang.Integer + false + + + + + true + + + + + + 2 + + + + + + defaultCatalog + java.lang.String + false + + + + + true + + + + + + 2 + + + + + + defaultSchema + java.lang.String + false + + + + + true + + + + + + 2 + + + + + + cacheState + boolean + false + + + + + true + + + + + + 2 + + + + + + driver + java.sql.Driver + false + + + + + true + + + + + + 2 + + + + + + driverClassName + java.lang.String + false + + + + + true + + + + + + 2 + + + + + + driverClassLoader + java.lang.ClassLoader + false + + + + + true + + + + + + 2 + + + + + + lifo + boolean + false + + + + + true + + + + + + 2 + + + + + + maxTotal + int + false + + + + + true + + + + + + 2 + + + + + + maxIdle + int + false + + + + + true + + + + + + 2 + + + + + + minIdle + int + false + + + + + true + + + + + + 2 + + + + + + initialSize + int + false + + + + + true + + + + + + 2 + + + + + + maxWaitMillis + long + false + + + + + true + + + + + + 2 + + + + + + poolPreparedStatements + boolean + false + + + + + true + + + + + + 2 + + + + + + maxOpenPreparedStatements + int + false + + + + + true + + + + + + 2 + + + + + + testOnCreate + boolean + false + + + + + true + + + + + + 2 + + + + + + testOnBorrow + boolean + false + + + + + true + + + + + + 2 + + + + + + testOnReturn + boolean + false + + + + + true + + + + + + 2 + + + + + + timeBetweenEvictionRunsMillis + long + false + + + + + true + + + + + + 2 + + + + + + numTestsPerEvictionRun + int + false + + + + + true + + + + + + 2 + + + + + + minEvictableIdleTimeMillis + long + false + + + + + true + + + + + + 2 + + + + + + softMinEvictableIdleTimeMillis + long + false + + + + + true + + + + + + 2 + + + + + + evictionPolicyClassName + java.lang.String + false + + + + + true + + + + + + 2 + + + + + + testWhileIdle + boolean + false + + + + + true + + + + + + 2 + + + + + + password + java.lang.String + false + + + + + true + + + + + + 2 + + + + + + url + java.lang.String + false + + + + + true + + + + + + 2 + + + + + + userName + java.lang.String + false + + + + + true + + + + + + 2 + + + + + + validationQuery + java.lang.String + false + + + + + true + + + + + + 2 + + + + + + validationQueryTimeoutSeconds + int + false + + + + + true + + + + + + 2 + + + + + + connectionInitSqls + java.util.List<java.lang.String> + false + + + + + true + + + + + + 2 + + + + + + accessToUnderlyingConnectionAllowed + boolean + false + + + + + true + + + + + + 2 + + + + + + maxConnLifetimeMillis + long + false + + + + + true + + + + + + 2 + + + + + + logExpiredConnections + boolean + false + + + + + true + + + + + + 2 + + + + + + jmxName + java.lang.String + false + + + + + true + + + + + + 2 + + + + + + autoCommitOnReturn + boolean + false + + + + + true + + + + + + 2 + + + + + + rollbackOnReturn + boolean + false + + + + + true + + + + + + 2 + + + + + + disconnectionSqlCodes + java.util.Set<java.lang.String> + false + + + + + true + + + + + + 2 + + + + + + fastFailValidation + boolean + false + + + + + true + + + + + + 2 + + + + + + connectionPool + org.apache.commons.pool2.impl.GenericObjectPool<org.apache.commons.dbcp2.PoolableConnection> + false + + + + + true + + + + + + 2 + + + + + + connectionProperties + java.util.Properties + false + + + + + true + + + + + + 2 + + + + + + dataSource + javax.sql.DataSource + false + + + + + true + + + + + + 2 + + + + + + logWriter + java.io.PrintWriter + false + + + + + true + + + + + + 2 + + + + + + abandonedConfig + org.apache.commons.pool2.impl.AbandonedConfig + false + + + + + true + + + + + + 2 + + + + + + closed + boolean + false + + + + + true + + + + + + 2 + + + + + + registeredJmxObjectName + org.apache.commons.dbcp2.ObjectNameWrapper + false + + + + + true + + + + + + 2 + + + + + + BasicDataSource + void + + false + false + + + + + true + + + + + + 2 + + + + + + validateConnectionFactory + void + + + connectionFactory + org.apache.commons.dbcp2.PoolableConnectionFactory + + + false + true + + + + + true + + + + + + 2 + + + + + + addConnectionProperty + void + + + name + java.lang.String + + + value + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + close + void + + false + false + + + + + true + + + + + + 2 + + + + + + closeConnectionPool + void + + false + false + + + + + true + + + + + + 2 + + + + + + createConnectionFactory + org.apache.commons.dbcp2.ConnectionFactory + + false + false + + + + + true + + + + + + 2 + + + + + + createConnectionPool + void + + + factory + org.apache.commons.dbcp2.PoolableConnectionFactory + + + false + false + + + + + true + + + + + + 2 + + + + + + createDataSource + javax.sql.DataSource + + false + false + + + + + true + + + + + + 2 + + + + + + createDataSourceInstance + javax.sql.DataSource + + false + false + + + + + true + + + + + + 2 + + + + + + createObjectPool + org.apache.commons.pool2.impl.GenericObjectPool<org.apache.commons.dbcp2.PoolableConnection> + + + factory + org.apache.commons.dbcp2.PoolableConnectionFactory + + + poolConfig + org.apache.commons.pool2.impl.GenericObjectPoolConfig<org.apache.commons.dbcp2.PoolableConnection> + + + abandonedConfig + org.apache.commons.pool2.impl.AbandonedConfig + + + false + false + + + + + true + + + + + + 2 + + + + + + createPoolableConnectionFactory + org.apache.commons.dbcp2.PoolableConnectionFactory + + + driverConnectionFactory + org.apache.commons.dbcp2.ConnectionFactory + + + false + false + + + + + true + + + + + + 2 + + + + + + getAbandonedLogWriter + java.io.PrintWriter + + false + false + + + + + true + + + + + + 2 + + + + + + getAbandonedUsageTracking + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + getAutoCommitOnReturn + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + getCacheState + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + getConnection + java.sql.Connection + + false + false + + + + + true + + + + + + 2 + + + + + + getConnection + java.sql.Connection + + + user + java.lang.String + + + pass + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getConnectionInitSqls + java.util.List<java.lang.String> + + false + false + + + + + true + + + + + + 2 + + + + + + getConnectionInitSqlsAsArray + java.lang.String[] + + false + false + + + + + true + + + + + + 2 + + + + + + getConnectionPool + org.apache.commons.pool2.impl.GenericObjectPool<org.apache.commons.dbcp2.PoolableConnection> + + false + false + + + + + true + + + + + + 2 + + + + + + getConnectionProperties + java.util.Properties + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultAutoCommit + java.lang.Boolean + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultCatalog + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultQueryTimeout + java.lang.Integer + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultReadOnly + java.lang.Boolean + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultSchema + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultTransactionIsolation + int + + false + false + + + + + true + + + + + + 2 + + + + + + getDisconnectionSqlCodes + java.util.Set<java.lang.String> + + false + false + + + + + true + + + + + + 2 + + + + + + getDisconnectionSqlCodesAsArray + java.lang.String[] + + false + false + + + + + true + + + + + + 2 + + + + + + getDriver + java.sql.Driver + + false + false + + + + + true + + + + + + 2 + + + + + + getDriverClassLoader + java.lang.ClassLoader + + false + false + + + + + true + + + + + + 2 + + + + + + getDriverClassName + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + getEnableAutoCommitOnReturn + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + getEvictionPolicyClassName + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + getFastFailValidation + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + getInitialSize + int + + false + false + + + + + true + + + + + + 2 + + + + + + getJmxName + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + getLifo + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + getLogAbandoned + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + getLogExpiredConnections + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + getLoginTimeout + int + + false + false + + + + + true + + + + + + 2 + + + + + + getLogWriter + java.io.PrintWriter + + false + false + + + + + true + + + + + + 2 + + + + + + getMaxConnLifetimeMillis + long + + false + false + + + + + true + + + + + + 2 + + + + + + getMaxIdle + int + + false + false + + + + + true + + + + + + 2 + + + + + + getMaxOpenPreparedStatements + int + + false + false + + + + + true + + + + + + 2 + + + + + + getMaxTotal + int + + false + false + + + + + true + + + + + + 2 + + + + + + getMaxWaitMillis + long + + false + false + + + + + true + + + + + + 2 + + + + + + getMinEvictableIdleTimeMillis + long + + false + false + + + + + true + + + + + + 2 + + + + + + getMinIdle + int + + false + false + + + + + true + + + + + + 2 + + + + + + getNumActive + int + + false + false + + + + + true + + + + + + 2 + + + + + + getNumIdle + int + + false + false + + + + + true + + + + + + 2 + + + + + + getNumTestsPerEvictionRun + int + + false + false + + + + + true + + + + + + 2 + + + + + + getParentLogger + java.util.logging.Logger + + false + false + + + + + true + + + + + + 2 + + + + + + getPassword + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + getRegisteredJmxName + javax.management.ObjectName + + false + false + + + + + true + + + + + + 2 + + + + + + getRemoveAbandonedOnBorrow + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + getRemoveAbandonedOnMaintenance + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + getRemoveAbandonedTimeout + int + + false + false + + + + + true + + + + + + 2 + + + + + + getRollbackOnReturn + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + getSoftMinEvictableIdleTimeMillis + long + + false + false + + + + + true + + + + + + 2 + + + + + + getTestOnBorrow + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + getTestOnCreate + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + getTestOnReturn + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + getTestWhileIdle + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + getTimeBetweenEvictionRunsMillis + long + + false + false + + + + + true + + + + + + 2 + + + + + + getUrl + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + getUsername + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + getValidationQuery + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + getValidationQueryTimeout + int + + false + false + + + + + true + + + + + + 2 + + + + + + invalidateConnection + void + + + connection + java.sql.Connection + + + false + false + + + + + true + + + + + + 2 + + + + + + evict + void + + false + false + + + + + true + + + + + + 2 + + + + + + isAccessToUnderlyingConnectionAllowed + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + isClosed + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + isPoolPreparedStatements + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + isWrapperFor + boolean + + + iface + java.lang.Class<?> + + + false + false + + + + + true + + + + + + 2 + + + + + + jmxRegister + void + + false + false + + + + + true + + + + + + 2 + + + + + + log + void + + + message + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + postDeregister + void + + false + false + + + + + true + + + + + + 2 + + + + + + postRegister + void + + + registrationDone + java.lang.Boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + preDeregister + void + + false + false + + + + + true + + + + + + 2 + + + + + + preRegister + javax.management.ObjectName + + + server + javax.management.MBeanServer + + + objectName + javax.management.ObjectName + + + false + false + + + + + true + + + + + + 2 + + + + + + removeConnectionProperty + void + + + name + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + setAbandonedLogWriter + void + + + logWriter + java.io.PrintWriter + + + false + false + + + + + true + + + + + + 2 + + + + + + setAbandonedUsageTracking + void + + + usageTracking + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setAccessToUnderlyingConnectionAllowed + void + + + allow + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setAutoCommitOnReturn + void + + + autoCommitOnReturn + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setCacheState + void + + + cacheState + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setConnectionInitSqls + void + + + connectionInitSqls + java.util.Collection<java.lang.String> + + + false + false + + + + + true + + + + + + 2 + + + + + + setConnectionProperties + void + + + connectionProperties + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultAutoCommit + void + + + defaultAutoCommit + java.lang.Boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultCatalog + void + + + defaultCatalog + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultQueryTimeout + void + + + defaultQueryTimeoutSeconds + java.lang.Integer + + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultReadOnly + void + + + defaultReadOnly + java.lang.Boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultSchema + void + + + defaultSchema + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultTransactionIsolation + void + + + defaultTransactionIsolation + int + + + false + false + + + + + true + + + + + + 2 + + + + + + setDisconnectionSqlCodes + void + + + disconnectionSqlCodes + java.util.Collection<java.lang.String> + + + false + false + + + + + true + + + + + + 2 + + + + + + setDriver + void + + + driver + java.sql.Driver + + + false + false + + + + + true + + + + + + 2 + + + + + + setDriverClassLoader + void + + + driverClassLoader + java.lang.ClassLoader + + + false + false + + + + + true + + + + + + 2 + + + + + + setDriverClassName + void + + + driverClassName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + setEnableAutoCommitOnReturn + void + + + autoCommitOnReturn + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setEvictionPolicyClassName + void + + + evictionPolicyClassName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + setFastFailValidation + void + + + fastFailValidation + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setInitialSize + void + + + initialSize + int + + + false + false + + + + + true + + + + + + 2 + + + + + + setJmxName + void + + + jmxName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + setLifo + void + + + lifo + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setLogAbandoned + void + + + logAbandoned + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setLogExpiredConnections + void + + + logExpiredConnections + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setLoginTimeout + void + + + loginTimeout + int + + + false + false + + + + + true + + + + + + 2 + + + + + + setLogWriter + void + + + logWriter + java.io.PrintWriter + + + false + false + + + + + true + + + + + + 2 + + + + + + setMaxConnLifetimeMillis + void + + + maxConnLifetimeMillis + long + + + false + false + + + + + true + + + + + + 2 + + + + + + setMaxIdle + void + + + maxIdle + int + + + false + false + + + + + true + + + + + + 2 + + + + + + setMaxOpenPreparedStatements + void + + + maxOpenStatements + int + + + false + false + + + + + true + + + + + + 2 + + + + + + setMaxTotal + void + + + maxTotal + int + + + false + false + + + + + true + + + + + + 2 + + + + + + setMaxWaitMillis + void + + + maxWaitMillis + long + + + false + false + + + + + true + + + + + + 2 + + + + + + setMinEvictableIdleTimeMillis + void + + + minEvictableIdleTimeMillis + long + + + false + false + + + + + true + + + + + + 2 + + + + + + setMinIdle + void + + + minIdle + int + + + false + false + + + + + true + + + + + + 2 + + + + + + setNumTestsPerEvictionRun + void + + + numTestsPerEvictionRun + int + + + false + false + + + + + true + + + + + + 2 + + + + + + setPassword + void + + + password + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + setPoolPreparedStatements + void + + + poolingStatements + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setRemoveAbandonedOnBorrow + void + + + removeAbandonedOnBorrow + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setRemoveAbandonedOnMaintenance + void + + + removeAbandonedOnMaintenance + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setRemoveAbandonedTimeout + void + + + removeAbandonedTimeout + int + + + false + false + + + + + true + + + + + + 2 + + + + + + setRollbackOnReturn + void + + + rollbackOnReturn + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setSoftMinEvictableIdleTimeMillis + void + + + softMinEvictableIdleTimeMillis + long + + + false + false + + + + + true + + + + + + 2 + + + + + + setTestOnBorrow + void + + + testOnBorrow + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setTestOnCreate + void + + + testOnCreate + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setTestOnReturn + void + + + testOnReturn + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setTestWhileIdle + void + + + testWhileIdle + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setTimeBetweenEvictionRunsMillis + void + + + timeBetweenEvictionRunsMillis + long + + + false + false + + + + + true + + + + + + 2 + + + + + + setUrl + void + + + url + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + setUsername + void + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + setValidationQuery + void + + + validationQuery + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + setValidationQueryTimeout + void + + + validationQueryTimeoutSeconds + int + + + false + false + + + + + true + + + + + + 2 + + + + + + startPoolMaintenance + void + + false + false + + + + + true + + + + + + 2 + + + + + + unwrap + T + + + iface + java.lang.Class<T> + + + false + false + + + + + true + + + + + + 2 + + + + + + updateJmxName + void + + + config + org.apache.commons.pool2.impl.GenericObjectPoolConfig<?> + + + false + false + + + + + true + + + + + + 2 + + + + + + <clinit> + void + + false + true + + + + + operationpackage + true + + + operationpublic + true + + + attrpublic + true + + + attrprotected + true + + + attrpackage + true + + + operationprivate + true + + + attrprivate + true + + + operationprotected + true + + + + + _stereo_type + Stereo Type + false + + + _simpleEntityName + Simple Name + false + + + _entityName + Name + false + + + _background + Background Color + false + + + _attrs + Attributes... + false + + + _operations + Operations... + false + + + _abstract + abstract + false + + + + org.apache.commons.dbcp2.BasicDataSource + false + + + + + + + + + + + + + + + + + + + true + + + + + 2 + + + + + + + + true + + + + + + 2 + + + + + + -1 + -1 + 1018 + 467 + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + + + true + + + + + 2 + + + + + + + + true + + + + + + 2 + + + + + + -1 + -1 + 420 + 319 + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + + + + + + true + + + + + + 2 + + + + + + serialVersionUID + long + true + + + + + true + + + + + + 2 + + + + + + log + org.apache.commons.logging.Log + true + + + + + true + + + + + + 2 + + + + + + perUserBlockWhenExhausted + java.util.Map<java.lang.String,java.lang.Boolean> + false + + + + + true + + + + + + 2 + + + + + + perUserEvictionPolicyClassName + java.util.Map<java.lang.String,java.lang.String> + false + + + + + true + + + + + + 2 + + + + + + perUserLifo + java.util.Map<java.lang.String,java.lang.Boolean> + false + + + + + true + + + + + + 2 + + + + + + perUserMaxIdle + java.util.Map<java.lang.String,java.lang.Integer> + false + + + + + true + + + + + + 2 + + + + + + perUserMaxTotal + java.util.Map<java.lang.String,java.lang.Integer> + false + + + + + true + + + + + + 2 + + + + + + perUserMaxWaitMillis + java.util.Map<java.lang.String,java.lang.Long> + false + + + + + true + + + + + + 2 + + + + + + perUserMinEvictableIdleTimeMillis + java.util.Map<java.lang.String,java.lang.Long> + false + + + + + true + + + + + + 2 + + + + + + perUserMinIdle + java.util.Map<java.lang.String,java.lang.Integer> + false + + + + + true + + + + + + 2 + + + + + + perUserNumTestsPerEvictionRun + java.util.Map<java.lang.String,java.lang.Integer> + false + + + + + true + + + + + + 2 + + + + + + perUserSoftMinEvictableIdleTimeMillis + java.util.Map<java.lang.String,java.lang.Long> + false + + + + + true + + + + + + 2 + + + + + + perUserTestOnCreate + java.util.Map<java.lang.String,java.lang.Boolean> + false + + + + + true + + + + + + 2 + + + + + + perUserTestOnBorrow + java.util.Map<java.lang.String,java.lang.Boolean> + false + + + + + true + + + + + + 2 + + + + + + perUserTestOnReturn + java.util.Map<java.lang.String,java.lang.Boolean> + false + + + + + true + + + + + + 2 + + + + + + perUserTestWhileIdle + java.util.Map<java.lang.String,java.lang.Boolean> + false + + + + + true + + + + + + 2 + + + + + + perUserTimeBetweenEvictionRunsMillis + java.util.Map<java.lang.String,java.lang.Long> + false + + + + + true + + + + + + 2 + + + + + + perUserDefaultAutoCommit + java.util.Map<java.lang.String,java.lang.Boolean> + false + + + + + true + + + + + + 2 + + + + + + perUserDefaultTransactionIsolation + java.util.Map<java.lang.String,java.lang.Integer> + false + + + + + true + + + + + + 2 + + + + + + perUserDefaultReadOnly + java.util.Map<java.lang.String,java.lang.Boolean> + false + + + + + true + + + + + + 2 + + + + + + managers + java.util.Map<org.apache.commons.dbcp2.datasources.PoolKey,org.apache.commons.dbcp2.datasources.PooledConnectionManager> + false + + + + + true + + + + + + 2 + + + + + + PerUserPoolDataSource + void + + false + false + + + + + true + + + + + + 2 + + + + + + clear + void + + false + false + + + + + true + + + + + + 2 + + + + + + close + void + + false + false + + + + + true + + + + + + 2 + + + + + + createMap + java.util.HashMap<java.lang.String,java.lang.Boolean> + + false + false + + + + + true + + + + + + 2 + + + + + + getConnectionManager + org.apache.commons.dbcp2.datasources.PooledConnectionManager + + + upKey + org.apache.commons.dbcp2.datasources.UserPassKey + + + false + false + + + + + true + + + + + + 2 + + + + + + getCPDSConnectionFactoryPool + org.apache.commons.pool2.ObjectPool<org.apache.commons.dbcp2.datasources.PooledConnectionAndInfo> + + + manager + org.apache.commons.dbcp2.datasources.PooledConnectionManager + + + false + false + + + + + true + + + + + + 2 + + + + + + getNumActive + int + + false + false + + + + + true + + + + + + 2 + + + + + + getNumActive + int + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getNumIdle + int + + false + false + + + + + true + + + + + + 2 + + + + + + getNumIdle + int + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getPerUserBlockWhenExhausted + boolean + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getPerUserDefaultAutoCommit + java.lang.Boolean + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getPerUserDefaultReadOnly + java.lang.Boolean + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getPerUserDefaultTransactionIsolation + java.lang.Integer + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getPerUserEvictionPolicyClassName + java.lang.String + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getPerUserLifo + boolean + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getPerUserMaxIdle + int + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getPerUserMaxTotal + int + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getPerUserMaxWaitMillis + long + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getPerUserMinEvictableIdleTimeMillis + long + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getPerUserMinIdle + int + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getPerUserNumTestsPerEvictionRun + int + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getPerUserSoftMinEvictableIdleTimeMillis + long + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getPerUserTestOnBorrow + boolean + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getPerUserTestOnCreate + boolean + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getPerUserTestOnReturn + boolean + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getPerUserTestWhileIdle + boolean + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getPerUserTimeBetweenEvictionRunsMillis + long + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getPool + org.apache.commons.pool2.ObjectPool<org.apache.commons.dbcp2.datasources.PooledConnectionAndInfo> + + + poolKey + org.apache.commons.dbcp2.datasources.PoolKey + + + false + false + + + + + true + + + + + + 2 + + + + + + getPooledConnectionAndInfo + org.apache.commons.dbcp2.datasources.PooledConnectionAndInfo + + + userName + java.lang.String + + + password + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getPoolKey + org.apache.commons.dbcp2.datasources.PoolKey + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getReference + javax.naming.Reference + + false + false + + + + + true + + + + + + 2 + + + + + + readObject + void + + + in + java.io.ObjectInputStream + + + false + false + + + + + true + + + + + + 2 + + + + + + registerPool + void + + + userName + java.lang.String + + + password + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserBlockWhenExhausted + void + + + userDefaultBlockWhenExhausted + java.util.Map<java.lang.String,java.lang.Boolean> + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserBlockWhenExhausted + void + + + userName + java.lang.String + + + value + java.lang.Boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserDefaultAutoCommit + void + + + userDefaultAutoCommit + java.util.Map<java.lang.String,java.lang.Boolean> + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserDefaultAutoCommit + void + + + userName + java.lang.String + + + value + java.lang.Boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserDefaultReadOnly + void + + + userDefaultReadOnly + java.util.Map<java.lang.String,java.lang.Boolean> + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserDefaultReadOnly + void + + + userName + java.lang.String + + + value + java.lang.Boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserDefaultTransactionIsolation + void + + + userDefaultTransactionIsolation + java.util.Map<java.lang.String,java.lang.Integer> + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserDefaultTransactionIsolation + void + + + userName + java.lang.String + + + value + java.lang.Integer + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserEvictionPolicyClassName + void + + + userDefaultEvictionPolicyClassName + java.util.Map<java.lang.String,java.lang.String> + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserEvictionPolicyClassName + void + + + userName + java.lang.String + + + value + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserLifo + void + + + userDefaultLifo + java.util.Map<java.lang.String,java.lang.Boolean> + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserLifo + void + + + userName + java.lang.String + + + value + java.lang.Boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserMaxIdle + void + + + userDefaultMaxIdle + java.util.Map<java.lang.String,java.lang.Integer> + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserMaxIdle + void + + + userName + java.lang.String + + + value + java.lang.Integer + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserMaxTotal + void + + + userDefaultMaxTotal + java.util.Map<java.lang.String,java.lang.Integer> + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserMaxTotal + void + + + userName + java.lang.String + + + value + java.lang.Integer + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserMaxWaitMillis + void + + + userDefaultMaxWaitMillis + java.util.Map<java.lang.String,java.lang.Long> + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserMaxWaitMillis + void + + + userName + java.lang.String + + + value + java.lang.Long + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserMinEvictableIdleTimeMillis + void + + + userDefaultMinEvictableIdleTimeMillis + java.util.Map<java.lang.String,java.lang.Long> + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserMinEvictableIdleTimeMillis + void + + + userName + java.lang.String + + + value + java.lang.Long + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserMinIdle + void + + + userDefaultMinIdle + java.util.Map<java.lang.String,java.lang.Integer> + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserMinIdle + void + + + userName + java.lang.String + + + value + java.lang.Integer + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserNumTestsPerEvictionRun + void + + + userDefaultNumTestsPerEvictionRun + java.util.Map<java.lang.String,java.lang.Integer> + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserNumTestsPerEvictionRun + void + + + userName + java.lang.String + + + value + java.lang.Integer + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserSoftMinEvictableIdleTimeMillis + void + + + userDefaultSoftMinEvictableIdleTimeMillis + java.util.Map<java.lang.String,java.lang.Long> + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserSoftMinEvictableIdleTimeMillis + void + + + userName + java.lang.String + + + value + java.lang.Long + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserTestOnBorrow + void + + + userDefaultTestOnBorrow + java.util.Map<java.lang.String,java.lang.Boolean> + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserTestOnBorrow + void + + + userName + java.lang.String + + + value + java.lang.Boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserTestOnCreate + void + + + userDefaultTestOnCreate + java.util.Map<java.lang.String,java.lang.Boolean> + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserTestOnCreate + void + + + userName + java.lang.String + + + value + java.lang.Boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserTestOnReturn + void + + + userDefaultTestOnReturn + java.util.Map<java.lang.String,java.lang.Boolean> + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserTestOnReturn + void + + + userName + java.lang.String + + + value + java.lang.Boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserTestWhileIdle + void + + + userDefaultTestWhileIdle + java.util.Map<java.lang.String,java.lang.Boolean> + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserTestWhileIdle + void + + + userName + java.lang.String + + + value + java.lang.Boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserTimeBetweenEvictionRunsMillis + void + + + userDefaultTimeBetweenEvictionRunsMillis + java.util.Map<java.lang.String,java.lang.Long> + + + false + false + + + + + true + + + + + + 2 + + + + + + setPerUserTimeBetweenEvictionRunsMillis + void + + + userName + java.lang.String + + + value + java.lang.Long + + + false + false + + + + + true + + + + + + 2 + + + + + + setupDefaults + void + + + con + java.sql.Connection + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + <clinit> + void + + false + true + + + + + operationpackage + true + + + operationpublic + true + + + attrpublic + true + + + attrprotected + true + + + attrpackage + true + + + operationprivate + true + + + attrprivate + true + + + operationprotected + true + + + + + _stereo_type + Stereo Type + false + + + _simpleEntityName + Simple Name + false + + + _entityName + Name + false + + + _background + Background Color + false + + + _attrs + Attributes... + false + + + _operations + Operations... + false + + + _abstract + abstract + false + + + + org.apache.commons.dbcp2.datasources.PerUserPoolDataSource + false + + + + + + true + + + + + 2 + + + + + + + + true + + + + + + 2 + + + + + + -1 + -1 + 943 + 250 + + + + + true + + + + + 2 + + + + + + + + + + + + + + + true + + + + + + 2 + + + + + + serialVersionUID + long + true + + + + + true + + + + + + 2 + + + + + + maxTotal + int + false + + + + + true + + + + + + 2 + + + + + + pool + org.apache.commons.pool2.KeyedObjectPool<org.apache.commons.dbcp2.datasources.UserPassKey,org.apache.commons.dbcp2.datasources.PooledConnectionAndInfo> + false + + + + + true + + + + + + 2 + + + + + + factory + org.apache.commons.dbcp2.datasources.KeyedCPDSConnectionFactory + false + + + + + true + + + + + + 2 + + + + + + SharedPoolDataSource + void + + false + false + + + + + true + + + + + + 2 + + + + + + close + void + + false + false + + + + + true + + + + + + 2 + + + + + + getMaxTotal + int + + false + false + + + + + true + + + + + + 2 + + + + + + setMaxTotal + void + + + maxTotal + int + + + false + false + + + + + true + + + + + + 2 + + + + + + getNumActive + int + + false + false + + + + + true + + + + + + 2 + + + + + + getNumIdle + int + + false + false + + + + + true + + + + + + 2 + + + + + + getPooledConnectionAndInfo + org.apache.commons.dbcp2.datasources.PooledConnectionAndInfo + + + userName + java.lang.String + + + userPassword + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getConnectionManager + org.apache.commons.dbcp2.datasources.PooledConnectionManager + + + upkey + org.apache.commons.dbcp2.datasources.UserPassKey + + + false + false + + + + + true + + + + + + 2 + + + + + + getReference + javax.naming.Reference + + false + false + + + + + true + + + + + + 2 + + + + + + registerPool + void + + + userName + java.lang.String + + + password + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + setupDefaults + void + + + connection + java.sql.Connection + + + userName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + readObject + void + + + in + java.io.ObjectInputStream + + + false + false + + + + + true + + + + + + 2 + + + + + + toStringFields + void + + + builder + java.lang.StringBuilder + + + false + false + + + + + operationpackage + true + + + operationpublic + true + + + attrpublic + true + + + attrprotected + true + + + attrpackage + true + + + operationprivate + true + + + attrprivate + true + + + operationprotected + true + + + + + _stereo_type + Stereo Type + false + + + _simpleEntityName + Simple Name + false + + + _entityName + Name + false + + + _background + Background Color + false + + + _attrs + Attributes... + false + + + _operations + Operations... + false + + + _abstract + abstract + false + + + + org.apache.commons.dbcp2.datasources.SharedPoolDataSource + false + + + + + + + + + + + + + true + + + + + + 2 + + + + + + serialVersionUID + long + true + + + + + true + + + + + + 2 + + + + + + GET_CONNECTION_CALLED + java.lang.String + true + + + + + true + + + + + + 2 + + + + + + BAD_TRANSACTION_ISOLATION + java.lang.String + true + + + + + true + + + + + + 2 + + + + + + UNKNOWN_TRANSACTIONISOLATION + int + true + + + + + true + + + + + + 2 + + + + + + getConnectionCalled + boolean + false + + + + + true + + + + + + 2 + + + + + + dataSource + javax.sql.ConnectionPoolDataSource + false + + + + + true + + + + + + 2 + + + + + + dataSourceName + java.lang.String + false + + + + + true + + + + + + 2 + + + + + + description + java.lang.String + false + + + + + true + + + + + + 2 + + + + + + jndiEnvironment + java.util.Properties + false + + + + + true + + + + + + 2 + + + + + + loginTimeout + int + false + + + + + true + + + + + + 2 + + + + + + logWriter + java.io.PrintWriter + false + + + + + true + + + + + + 2 + + + + + + instanceKey + java.lang.String + false + + + + + true + + + + + + 2 + + + + + + defaultBlockWhenExhausted + boolean + false + + + + + true + + + + + + 2 + + + + + + defaultEvictionPolicyClassName + java.lang.String + false + + + + + true + + + + + + 2 + + + + + + defaultLifo + boolean + false + + + + + true + + + + + + 2 + + + + + + defaultMaxIdle + int + false + + + + + true + + + + + + 2 + + + + + + defaultMaxTotal + int + false + + + + + true + + + + + + 2 + + + + + + defaultMaxWaitMillis + long + false + + + + + true + + + + + + 2 + + + + + + defaultMinEvictableIdleTimeMillis + long + false + + + + + true + + + + + + 2 + + + + + + defaultMinIdle + int + false + + + + + true + + + + + + 2 + + + + + + defaultNumTestsPerEvictionRun + int + false + + + + + true + + + + + + 2 + + + + + + defaultSoftMinEvictableIdleTimeMillis + long + false + + + + + true + + + + + + 2 + + + + + + defaultTestOnCreate + boolean + false + + + + + true + + + + + + 2 + + + + + + defaultTestOnBorrow + boolean + false + + + + + true + + + + + + 2 + + + + + + defaultTestOnReturn + boolean + false + + + + + true + + + + + + 2 + + + + + + defaultTestWhileIdle + boolean + false + + + + + true + + + + + + 2 + + + + + + defaultTimeBetweenEvictionRunsMillis + long + false + + + + + true + + + + + + 2 + + + + + + validationQuery + java.lang.String + false + + + + + true + + + + + + 2 + + + + + + validationQueryTimeoutSeconds + int + false + + + + + true + + + + + + 2 + + + + + + rollbackAfterValidation + boolean + false + + + + + true + + + + + + 2 + + + + + + maxConnLifetimeMillis + long + false + + + + + true + + + + + + 2 + + + + + + defaultAutoCommit + java.lang.Boolean + false + + + + + true + + + + + + 2 + + + + + + defaultTransactionIsolation + int + false + + + + + true + + + + + + 2 + + + + + + defaultReadOnly + java.lang.Boolean + false + + + + + true + + + + + + 2 + + + + + + InstanceKeyDataSource + void + + false + false + + + + + true + + + + + + 2 + + + + + + assertInitializationAllowed + void + + false + false + + + + + true + + + + + + 2 + + + + + + close + void + + true + false + + + + + true + + + + + + 2 + + + + + + getConnectionManager + org.apache.commons.dbcp2.datasources.PooledConnectionManager + + + upkey + org.apache.commons.dbcp2.datasources.UserPassKey + + + true + false + + + + + true + + + + + + 2 + + + + + + isWrapperFor + boolean + + + iface + java.lang.Class<?> + + + false + false + + + + + true + + + + + + 2 + + + + + + unwrap + T + + + iface + java.lang.Class<T> + + + false + false + + + + + true + + + + + + 2 + + + + + + getParentLogger + java.util.logging.Logger + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultBlockWhenExhausted + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultBlockWhenExhausted + void + + + blockWhenExhausted + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultEvictionPolicyClassName + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultEvictionPolicyClassName + void + + + evictionPolicyClassName + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultLifo + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultLifo + void + + + lifo + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultMaxIdle + int + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultMaxIdle + void + + + maxIdle + int + + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultMaxTotal + int + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultMaxTotal + void + + + maxTotal + int + + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultMaxWaitMillis + long + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultMaxWaitMillis + void + + + maxWaitMillis + long + + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultMinEvictableIdleTimeMillis + long + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultMinEvictableIdleTimeMillis + void + + + minEvictableIdleTimeMillis + long + + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultMinIdle + int + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultMinIdle + void + + + minIdle + int + + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultNumTestsPerEvictionRun + int + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultNumTestsPerEvictionRun + void + + + numTestsPerEvictionRun + int + + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultSoftMinEvictableIdleTimeMillis + long + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultSoftMinEvictableIdleTimeMillis + void + + + softMinEvictableIdleTimeMillis + long + + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultTestOnCreate + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultTestOnCreate + void + + + testOnCreate + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultTestOnBorrow + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultTestOnBorrow + void + + + testOnBorrow + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultTestOnReturn + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultTestOnReturn + void + + + testOnReturn + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultTestWhileIdle + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultTestWhileIdle + void + + + testWhileIdle + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultTimeBetweenEvictionRunsMillis + long + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultTimeBetweenEvictionRunsMillis + void + + + timeBetweenEvictionRunsMillis + long + + + false + false + + + + + true + + + + + + 2 + + + + + + getConnectionPoolDataSource + javax.sql.ConnectionPoolDataSource + + false + false + + + + + true + + + + + + 2 + + + + + + setConnectionPoolDataSource + void + + + v + javax.sql.ConnectionPoolDataSource + + + false + false + + + + + true + + + + + + 2 + + + + + + getDataSourceName + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + setDataSourceName + void + + + v + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + isDefaultAutoCommit + java.lang.Boolean + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultAutoCommit + void + + + v + java.lang.Boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + isDefaultReadOnly + java.lang.Boolean + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultReadOnly + void + + + v + java.lang.Boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + getDefaultTransactionIsolation + int + + false + false + + + + + true + + + + + + 2 + + + + + + setDefaultTransactionIsolation + void + + + v + int + + + false + false + + + + + true + + + + + + 2 + + + + + + getDescription + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + setDescription + void + + + v + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getInstanceKey + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + getJndiEnvironment + java.lang.String + + + key + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + setJndiEnvironment + void + + + key + java.lang.String + + + value + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + setJndiEnvironment + void + + + properties + java.util.Properties + + + false + false + + + + + true + + + + + + 2 + + + + + + getLoginTimeout + int + + false + false + + + + + true + + + + + + 2 + + + + + + setLoginTimeout + void + + + v + int + + + false + false + + + + + true + + + + + + 2 + + + + + + getLogWriter + java.io.PrintWriter + + false + false + + + + + true + + + + + + 2 + + + + + + setLogWriter + void + + + v + java.io.PrintWriter + + + false + false + + + + + true + + + + + + 2 + + + + + + getValidationQuery + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + setValidationQuery + void + + + validationQuery + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getValidationQueryTimeout + int + + false + false + + + + + true + + + + + + 2 + + + + + + setValidationQueryTimeout + void + + + validationQueryTimeoutSeconds + int + + + false + false + + + + + true + + + + + + 2 + + + + + + isRollbackAfterValidation + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + setRollbackAfterValidation + void + + + rollbackAfterValidation + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + getMaxConnLifetimeMillis + long + + false + false + + + + + true + + + + + + 2 + + + + + + setMaxConnLifetimeMillis + void + + + maxConnLifetimeMillis + long + + + false + false + + + + + true + + + + + + 2 + + + + + + getConnection + java.sql.Connection + + false + false + + + + + true + + + + + + 2 + + + + + + getConnection + java.sql.Connection + + + userName + java.lang.String + + + userPassword + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getPooledConnectionAndInfo + org.apache.commons.dbcp2.datasources.PooledConnectionAndInfo + + + userName + java.lang.String + + + userPassword + java.lang.String + + + true + false + + + + + true + + + + + + 2 + + + + + + setupDefaults + void + + + connection + java.sql.Connection + + + userName + java.lang.String + + + true + false + + + + + true + + + + + + 2 + + + + + + closeDueToException + void + + + info + org.apache.commons.dbcp2.datasources.PooledConnectionAndInfo + + + false + false + + + + + true + + + + + + 2 + + + + + + testCPDS + javax.sql.ConnectionPoolDataSource + + + userName + java.lang.String + + + userPassword + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + toString + java.lang.String + + false + false + + + + + true + + + + + + 2 + + + + + + toStringFields + void + + + builder + java.lang.StringBuilder + + + false + false + + + + + operationpackage + true + + + operationpublic + true + + + attrpublic + true + + + attrprotected + true + + + attrpackage + true + + + operationprivate + true + + + attrprivate + true + + + operationprotected + true + + + + + _stereo_type + Stereo Type + false + + + _simpleEntityName + Simple Name + false + + + _entityName + Name + false + + + _background + Background Color + false + + + _attrs + Attributes... + false + + + _operations + Operations... + false + + + _abstract + abstract + false + + + + org.apache.commons.dbcp2.datasources.InstanceKeyDataSource + false + + + + + + + true + + + + + 2 + + + + + + + + true + + + + + + 2 + + + + + + -1 + -1 + 683 + 545 + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + true + + + + + 2 + + + + + + + + + + + + true + + + + + 2 + + + + + + + + true + + + + + + 2 + + + + + + -1 + -1 + 437 + 439 + + + + + + + + + + true + + + + + + 2 + + + + + + transactionRegistry + org.apache.commons.dbcp2.managed.TransactionRegistry + false + + + + + true + + + + + + 2 + + + + + + ManagedDataSource + void + + + pool + org.apache.commons.pool2.ObjectPool<C> + + + transactionRegistry + org.apache.commons.dbcp2.managed.TransactionRegistry + + + false + false + + + + + true + + + + + + 2 + + + + + + getConnection + java.sql.Connection + + false + false + + + + + true + + + + + + 2 + + + + + + getTransactionRegistry + org.apache.commons.dbcp2.managed.TransactionRegistry + + false + false + + + + + true + + + + + + 2 + + + + + + setTransactionRegistry + void + + + transactionRegistry + org.apache.commons.dbcp2.managed.TransactionRegistry + + + false + false + + + + + operationpackage + true + + + operationpublic + true + + + attrpublic + true + + + attrprotected + true + + + attrpackage + true + + + operationprivate + true + + + attrprivate + true + + + operationprotected + true + + + + + _stereo_type + Stereo Type + false + + + _simpleEntityName + Simple Name + false + + + _entityName + Name + false + + + _background + Background Color + false + + + _attrs + Attributes... + false + + + _operations + Operations... + false + + + _abstract + abstract + false + + + + org.apache.commons.dbcp2.managed.ManagedDataSource + false + + + + + + + + + + true + + + + + + 2 + + + + + + log + org.apache.commons.logging.Log + true + + + + + true + + + + + + 2 + + + + + + accessToUnderlyingConnectionAllowed + boolean + false + + + + + true + + + + + + 2 + + + + + + logWriter + java.io.PrintWriter + false + + + + + true + + + + + + 2 + + + + + + pool + org.apache.commons.pool2.ObjectPool<C> + false + + + + + true + + + + + + 2 + + + + + + PoolingDataSource + void + + + pool + org.apache.commons.pool2.ObjectPool<C> + + + false + false + + + + + true + + + + + + 2 + + + + + + close + void + + false + false + + + + + true + + + + + + 2 + + + + + + isAccessToUnderlyingConnectionAllowed + boolean + + false + false + + + + + true + + + + + + 2 + + + + + + setAccessToUnderlyingConnectionAllowed + void + + + allow + boolean + + + false + false + + + + + true + + + + + + 2 + + + + + + isWrapperFor + boolean + + + iface + java.lang.Class<?> + + + false + false + + + + + true + + + + + + 2 + + + + + + unwrap + T + + + iface + java.lang.Class<T> + + + false + false + + + + + true + + + + + + 2 + + + + + + getParentLogger + java.util.logging.Logger + + false + false + + + + + true + + + + + + 2 + + + + + + getConnection + java.sql.Connection + + false + false + + + + + true + + + + + + 2 + + + + + + getConnection + java.sql.Connection + + + uname + java.lang.String + + + passwd + java.lang.String + + + false + false + + + + + true + + + + + + 2 + + + + + + getLogWriter + java.io.PrintWriter + + false + false + + + + + true + + + + + + 2 + + + + + + getLoginTimeout + int + + false + false + + + + + true + + + + + + 2 + + + + + + setLoginTimeout + void + + + seconds + int + + + false + false + + + + + true + + + + + + 2 + + + + + + setLogWriter + void + + + out + java.io.PrintWriter + + + false + false + + + + + true + + + + + + 2 + + + + + + getPool + org.apache.commons.pool2.ObjectPool<C> + + false + false + + + + + true + + + + + + 2 + + + + + + <clinit> + void + + false + true + + + + + operationpackage + true + + + operationpublic + true + + + attrpublic + true + + + attrprotected + true + + + attrpackage + true + + + operationprivate + true + + + attrprivate + true + + + operationprotected + true + + + + + _stereo_type + Stereo Type + false + + + _simpleEntityName + Simple Name + false + + + _entityName + Name + false + + + _background + Background Color + false + + + _attrs + Attributes... + false + + + _operations + Operations... + false + + + _abstract + abstract + false + + + + org.apache.commons.dbcp2.PoolingDataSource + false + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + 2 + + + + + + getConnection + java.sql.Connection + + true + false + + + + + true + + + + + + 2 + + + + + + getConnection + java.sql.Connection + + + username + java.lang.String + + + password + java.lang.String + + + true + false + + + + + operationpackage + true + + + operationpublic + true + + + attrpublic + true + + + attrprotected + true + + + attrpackage + true + + + operationprivate + true + + + attrprivate + true + + + operationprotected + true + + + + + _stereo_type + Stereo Type + false + + + _simpleEntityName + Simple Name + false + + + _entityName + Name + false + + + _background + Background Color + false + + + _attrs + Attributes... + false + + + _operations + Operations... + false + + + + javax.sql.DataSource + + + + + + + + + + + + operationpackage + true + + + operationpublic + true + + + attrpublic + true + + + attrprotected + true + + + attrpackage + true + + + operationprivate + true + + + attrprivate + true + + + operationprotected + true + + + \ No newline at end of file diff --git a/src/main/java/cn/zzs/dbcp/BasicDataSourceUtil.java b/src/main/java/cn/zzs/dbcp/BasicDataSourceUtil.java new file mode 100644 index 0000000..18880c7 --- /dev/null +++ b/src/main/java/cn/zzs/dbcp/BasicDataSourceUtil.java @@ -0,0 +1,184 @@ +package cn.zzs.dbcp; + +import java.io.InputStream; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.Properties; + +import javax.sql.DataSource; + +import org.apache.commons.dbcp2.BasicDataSourceFactory; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * @ClassName: BasicDataSourceUtil + * @Description: 用于获取数据库连接对象的工具类。这里使用BasicDataSource获取连接对象,获取到的连接对象可满足一般的数据库操作 + * @author: zzs + * @date: 2019年8月31日 下午9:05:08 + */ +public class BasicDataSourceUtil { + + private static DataSource dataSource; + + private static ThreadLocal tl = new ThreadLocal<>(); + + private static final Object obj = new Object(); + + private static final Log log = LogFactory.getLog(BasicDataSourceUtil.class); + + static { + init(); + } + + /** + * + * @Title: getConnection + * @Description: 获取数据库连接对象的方法,线程安全 + * @author: zzs + * @date: 2019年8月31日 下午9:22:29 + * @return: Connection + */ + public static Connection getConnection() throws SQLException { + // 从当前线程中获取连接对象 + Connection connection = tl.get(); + // 判断为空的话,创建连接并绑定到当前线程 + if(connection == null) { + synchronized(obj) { + if(tl.get() == null) { + connection = createConnection(); + tl.set(connection); + } + } + } + return connection; + } + + /** + * + * @Title: release + * @Description: 释放资源 + * @author: zzs + * @date: 2019年8月31日 下午9:39:24 + * @param conn + * @param statement + * @return: void + */ + public static void release(Connection conn, Statement statement, ResultSet resultSet) { + if(resultSet != null) { + try { + resultSet.close(); + } catch(SQLException e) { + log.error("关闭ResultSet对象异常", e); + } + } + if(statement != null) { + try { + statement.close(); + } catch(SQLException e) { + log.error("关闭Statement对象异常", e); + } + } + // 注意:这里不关闭连接 + if(conn != null) { + try { + conn.close(); + tl.remove(); + } catch(SQLException e) { + log.error("关闭Connection对象异常", e); + } + } + } + + /** + * + * @Title: startTrasaction + * @Description: 开启事务 + * @author: zzs + * @date: 2019年11月3日 上午11:03:24 + * @return: void + * @throws Exception + */ + public static void startTrasaction() throws SQLException { + getConnection().setAutoCommit(false); + } + + /** + * + * @Title: commit + * @Description: 提交事务 + * @author: zzs + * @date: 2019年11月3日 上午11:05:54 + * @return: void + */ + public static void commit() { + Connection connection = tl.get(); + if(connection != null) { + try { + connection.commit(); + connection.setAutoCommit(true); + } catch(SQLException e) { + log.error("提交事务失败", e); + } + } + } + + /** + * + * @Title: rollback + * @Description: 回滚事务 + * @author: zzs + * @date: 2019年11月3日 上午11:08:12 + * @return: void + */ + public static void rollback() { + Connection connection = tl.get(); + if(connection != null) { + try { + connection.rollback(); + connection.setAutoCommit(true); + } catch(SQLException e) { + log.error("回滚事务失败", e); + } + } + } + + /** + * + * @Title: createConnection + * @Description: 创建数据库连接 + * @author: zzs + * @date: 2019年8月31日 下午9:27:03 + * @return: Connection + * @throws SQLException + */ + private static Connection createConnection() throws SQLException { + Connection conn = null; + // 获得连接 + conn = dataSource.getConnection(); + return conn; + } + + /** + * @Title: init + * @Description: 根据指定配置文件创建数据源对象 + * @author: zzs + * @date: 2019年9月1日 上午10:53:05 + * @return: void + * @throws Exception + */ + private static void init() { + // 导入配置文件 + Properties properties = new Properties(); + InputStream in = BasicDataSourceUtil.class.getClassLoader().getResourceAsStream("jdbc.properties"); + try { + properties.load(in); + // 根据配置文件内容获得数据源对象 + dataSource = BasicDataSourceFactory.createDataSource(properties); + } catch(Exception ex) { + throw new RuntimeException("根据指定配置文件创建数据源出错", ex); + } + } +} diff --git a/src/main/java/cn/zzs/dbcp/JDBCUtil.java b/src/main/java/cn/zzs/dbcp/JDBCUtil.java deleted file mode 100644 index f21df69..0000000 --- a/src/main/java/cn/zzs/dbcp/JDBCUtil.java +++ /dev/null @@ -1,136 +0,0 @@ -package cn.zzs.dbcp; - -import java.io.IOException; -import java.io.InputStream; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.Properties; - -import javax.sql.DataSource; - -import org.apache.commons.dbcp2.BasicDataSourceFactory; - -/** - * @ClassName: JDBCUtil - * @Description: 用于获取数据库连接对象的工具类 - * @author: zzs - * @date: 2019年8月31日 下午9:05:08 - */ -public class JDBCUtil { - private static DataSource dataSource; - private static ThreadLocal tl = new ThreadLocal<>(); - private static Object obj = new Object(); - - static { - init(); - } - /** - * - * @Title: getConnection - * @Description: 获取数据库连接对象的方法,线程安全 - * @author: zzs - * @date: 2019年8月31日 下午9:22:29 - * @return: Connection - */ - public static Connection getConnection(){ - //从当前线程中获取连接对象 - Connection connection = tl.get(); - //判断为空的话,创建连接并绑定到当前线程 - if(connection == null) { - synchronized (obj) { - if(tl.get() == null) { - connection = createConnection(); - tl.set(connection); - } - } - } - return connection; - } - /** - * - * @Title: release - * @Description: 释放资源 - * @author: zzs - * @date: 2019年8月31日 下午9:39:24 - * @param conn - * @param statement - * @return: void - */ - public static void release(Connection conn,Statement statement,ResultSet resultSet) { - if(resultSet!=null) { - try { - resultSet.close(); - } catch (SQLException e) { - System.err.println("关闭ResultSet对象异常"); - e.printStackTrace(); - } - } - if(statement != null) { - try { - statement.close(); - } catch (SQLException e) { - System.err.println("关闭Statement对象异常"); - e.printStackTrace(); - } - } - //注意:这里不关闭连接 - if(conn!=null) { - try { - //如果连接失效的话,从当前线程的绑定中删除 - if(!conn.isValid(3)) { - tl.remove(); - } - } catch (SQLException e) { - System.err.println("校验连接有效性"); - e.printStackTrace(); - } - } - } - - /** - * - * @Title: createConnection - * @Description: 创建数据库连接 - * @author: zzs - * @date: 2019年8月31日 下午9:27:03 - * @return: Connection - */ - private static Connection createConnection(){ - Connection conn = null; - //获得连接 - try { - conn = dataSource.getConnection(); - } catch (SQLException e) { - System.err.println("从数据源获取连接失败"); - e.printStackTrace(); - } - return conn; - } - - /** - * @Title: init - * @Description: 根据指定配置文件创建数据源对象 - * @author: zzs - * @date: 2019年9月1日 上午10:53:05 - * @return: void - */ - private static void init() { - //导入配置文件 - Properties properties = new Properties(); - InputStream in = JDBCUtil.class.getClassLoader().getResourceAsStream("jdbc.properties"); - try { - properties.load(in); - //根据配置文件内容获得数据源对象 - dataSource = BasicDataSourceFactory.createDataSource(properties); - } catch (IOException e) { - System.err.println("导入配置文件出错"); - e.printStackTrace(); - } catch (Exception e) { - System.err.println("根据指定配置文件创建数据源出错"); - e.printStackTrace(); - } - } -} - diff --git a/src/main/resources/jdbc.properties b/src/main/resources/jdbc.properties index 56f0c42..064f22d 100644 --- a/src/main/resources/jdbc.properties +++ b/src/main/resources/jdbc.properties @@ -1,99 +1,183 @@ -#数据库基本配置 +#\u6570\u636e\u5e93\u57fa\u672c\u914d\u7f6e driverClassName=com.mysql.cj.jdbc.Driver -url=jdbc:mysql://localhost:3306/demo?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=true +url=jdbc:mysql://localhost:3306/github_demo?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=true username=root password=root -#-------------连接数据相关参数-------------------------------- -#初始化连接:连接池启动时创建的初始化连接数量 -#默认为0 +#-------------\u8fde\u63a5\u6c60\u6570\u636e\u76f8\u5173\u53c2\u6570-------------------------------- +#\u521d\u59cb\u5316\u8fde\u63a5\u6570\u91cf:\u8fde\u63a5\u6c60\u542f\u52a8\u65f6\u521b\u5efa\u7684\u521d\u59cb\u5316\u8fde\u63a5\u6570\u91cf +#\u9ed8\u8ba4\u4e3a0 initialSize=0 -#最大活动连接 -#连接池在同一时间能够分配的最大活动连接的数量, 如果设置为非正数则表示不限制 -#默认为8 -maxActive=8 -#最大空闲连接 -#连接池中容许保持空闲状态的最大连接数量,超过的空闲连接将被释放,如果设置为负数表示不限制 -#默认为8 + +#\u6700\u5927\u6d3b\u52a8\u8fde\u63a5\u6570\u91cf:\u8fde\u63a5\u6c60\u5728\u540c\u4e00\u65f6\u95f4\u80fd\u591f\u5206\u914d\u7684\u6700\u5927\u6d3b\u52a8\u8fde\u63a5\u7684\u6570\u91cf, \u5982\u679c\u8bbe\u7f6e\u4e3a\u8d1f\u6570\u5219\u8868\u793a\u4e0d\u9650\u5236 +#\u9ed8\u8ba4\u4e3a8 +maxTotal=8 + +#\u6700\u5927\u7a7a\u95f2\u8fde\u63a5:\u8fde\u63a5\u6c60\u4e2d\u5bb9\u8bb8\u4fdd\u6301\u7a7a\u95f2\u72b6\u6001\u7684\u6700\u5927\u8fde\u63a5\u6570\u91cf,\u8d85\u8fc7\u7684\u7a7a\u95f2\u8fde\u63a5\u5c06\u88ab\u91ca\u653e,\u5982\u679c\u8bbe\u7f6e\u4e3a\u8d1f\u6570\u8868\u793a\u4e0d\u9650\u5236 +#\u9ed8\u8ba4\u4e3a8 maxIdle=8 -#最小空闲连接 -#连接池中容许保持空闲状态的最小连接数量,低于这个数量将创建新的连接,如果设置为0则不创建 -#默认为0 + +#\u6700\u5c0f\u7a7a\u95f2\u8fde\u63a5:\u8fde\u63a5\u6c60\u4e2d\u5bb9\u8bb8\u4fdd\u6301\u7a7a\u95f2\u72b6\u6001\u7684\u6700\u5c0f\u8fde\u63a5\u6570\u91cf,\u4f4e\u4e8e\u8fd9\u4e2a\u6570\u91cf\u5c06\u521b\u5efa\u65b0\u7684\u8fde\u63a5,\u5982\u679c\u8bbe\u7f6e\u4e3a0\u5219\u4e0d\u521b\u5efa +#\u6ce8\u610f\uff1atimeBetweenEvictionRunsMillis\u4e3a\u6b63\u6570\u65f6\uff0c\u8fd9\u4e2a\u53c2\u6570\u624d\u80fd\u751f\u6548\u3002 +#\u9ed8\u8ba4\u4e3a0 minIdle=0 -#最大等待时间 -#当没有可用连接时,连接池等待连接被归还的最大时间(以毫秒计数),超过时间则抛出异常,如果设置为-1表示无限等待 -#默认无限 -maxWait=-1 - -#-------------事务相关的属性-------------------------------- -#连接池创建的连接的默认的auto-commit状态 -#默认为true -defaultAutoCommit=false -#连接池创建的连接的默认的read-only状态. 如果没有设置则setReadOnly方法将不会被调用. (某些驱动不支持只读模式,比如:Informix) -#默认值由驱动决定 -#defaultReadOnly=false -#连接池创建的连接的默认的TransactionIsolation状态 -#可用值为下列之一:NONE,READ_UNCOMMITTED, READ_COMMITTED, REPEATABLE_READ, SERIALIZABLE -#默认值由驱动决定 -defaultTransactionIsolation=REPEATABLE_READ -#连接池创建的连接的默认的catalog -#defaultCatalog - -#-------------连接检查情况-------------------------------- -#SQL查询,用来验证从连接池取出的连接,在将连接返回给调用者之前.如果指定,则查询必须是一个SQL SELECT并且必须返回至少一行记录 -validationQuery= select 1 -#指明是否在从池中取出连接前进行检验,如果检验失败,则从池中去除连接并尝试取出另一个. -#注意: 设置为true后如果要生效,validationQuery参数必须设置为非空字符串 -#默认为true + +#\u6700\u5927\u7b49\u5f85\u65f6\u95f4 +#\u5f53\u6ca1\u6709\u53ef\u7528\u8fde\u63a5\u65f6,\u8fde\u63a5\u6c60\u7b49\u5f85\u8fde\u63a5\u88ab\u5f52\u8fd8\u7684\u6700\u5927\u65f6\u95f4(\u4ee5\u6beb\u79d2\u8ba1\u6570),\u8d85\u8fc7\u65f6\u95f4\u5219\u629b\u51fa\u5f02\u5e38,\u5982\u679c\u8bbe\u7f6e\u4e3a<=0\u8868\u793a\u65e0\u9650\u7b49\u5f85 +#\u9ed8\u8ba4-1 +maxWaitMillis=-1 + + +#-------------\u8fde\u63a5\u68c0\u67e5\u60c5\u51b5-------------------------------- +#\u901a\u8fc7SQL\u67e5\u8be2\u68c0\u6d4b\u8fde\u63a5,\u6ce8\u610f\u5fc5\u987b\u8fd4\u56de\u81f3\u5c11\u4e00\u884c\u8bb0\u5f55 +#\u9ed8\u8ba4\u4e3a\u7a7a\u3002\u5373\u4f1a\u8c03\u7528Connection\u7684isValid\u548cisClosed\u8fdb\u884c\u68c0\u6d4b +#\u6ce8\u610f\uff1a\u5982\u679c\u662foracle\u6570\u636e\u5e93\u7684\u8bdd\uff0c\u5e94\u8be5\u6539\u4e3aselect 1 from dual +validationQuery=select 1 from dual + +#SQL\u68c0\u9a8c\u8d85\u65f6\u65f6\u95f4 +validationQueryTimeout=-1 + +#\u662f\u5426\u4ece\u6c60\u4e2d\u53d6\u51fa\u8fde\u63a5\u524d\u8fdb\u884c\u68c0\u9a8c\u3002 +#\u9ed8\u8ba4\u4e3atrue testOnBorrow=true -#指明是否在归还到池中前进行检验 -#注意: 设置为true后如果要生效,validationQuery参数必须设置为非空字符串 -#默认为false + +#\u662f\u5426\u5728\u5f52\u8fd8\u5230\u6c60\u4e2d\u524d\u8fdb\u884c\u68c0\u9a8c +#\u9ed8\u8ba4\u4e3afalse testOnReturn=false -#是否开启空闲资源监测。 -#注意: 设置为true后如果要生效,validationQuery参数必须设置为非空字符串 -#默认为false -testWhileIdle= true -#空闲资源的检测周期(单位为毫秒)。默认-1:不检测。建议设置,周期自行选择。timeBetweenEvictionRunsMillis=30000 -#做空闲资源检测时,每次的采样数。默认3。 -#可根据自身应用连接数进行微调,如果设置为-1,就是对所有连接做空闲监测。 + +#\u662f\u5426\u5f00\u542f\u7a7a\u95f2\u8d44\u6e90\u56de\u6536\u5668\u3002 +#\u9ed8\u8ba4\u4e3afalse +testWhileIdle=false + +#\u7a7a\u95f2\u8d44\u6e90\u7684\u68c0\u6d4b\u5468\u671f(\u5355\u4f4d\u4e3a\u6beb\u79d2)\u3002 +#\u9ed8\u8ba4-1\u3002\u5373\u7a7a\u95f2\u8d44\u6e90\u56de\u6536\u5668\u4e0d\u5de5\u4f5c\u3002 +timeBetweenEvictionRunsMillis=-1 + +#\u505a\u7a7a\u95f2\u8d44\u6e90\u56de\u6536\u5668\u65f6\uff0c\u6bcf\u6b21\u7684\u91c7\u6837\u6570\u3002 +#\u9ed8\u8ba43\uff0c\u5355\u4f4d\u6beb\u79d2\u3002\u5982\u679c\u8bbe\u7f6e\u4e3a-1\uff0c\u5c31\u662f\u5bf9\u6240\u6709\u8fde\u63a5\u505a\u7a7a\u95f2\u76d1\u6d4b\u3002 numTestsPerEvictionRun=3 -#资源池中资源最小空闲时间(单位为毫秒),达到此值后空闲资源将被移除。 -#默认值1000*60*30 = 30分钟。建议默认,或根据自身业务选择。 + +#\u8d44\u6e90\u6c60\u4e2d\u8d44\u6e90\u6700\u5c0f\u7a7a\u95f2\u65f6\u95f4(\u5355\u4f4d\u4e3a\u6beb\u79d2)\uff0c\u8fbe\u5230\u6b64\u503c\u540e\u5c06\u88ab\u79fb\u9664\u3002 +#\u9ed8\u8ba4\u503c1000*60*30 = 30\u5206\u949f minEvictableIdleTimeMillis=1800000 -#-------------缓存语句-------------------------------- -#开启池的prepared statement 池功能 -#注意: 确认连接还有剩余资源可以留给其他statement -#默认为false +#\u8d44\u6e90\u6c60\u4e2d\u8d44\u6e90\u6700\u5c0f\u7a7a\u95f2\u65f6\u95f4(\u5355\u4f4d\u4e3a\u6beb\u79d2)\uff0c\u8fbe\u5230\u6b64\u503c\u540e\u5c06\u88ab\u79fb\u9664\u3002\u4f46\u662f\u4f1a\u4fdd\u8bc1minIdle +#\u9ed8\u8ba4\u503c-1 +#softMinEvictableIdleTimeMillis=-1 + +#\u7a7a\u95f2\u8d44\u6e90\u56de\u6536\u7b56\u7565 +#\u9ed8\u8ba4org.apache.commons.pool2.impl.DefaultEvictionPolicy +#\u5982\u679c\u8981\u81ea\u5b9a\u4e49\u7684\u8bdd\uff0c\u9700\u8981\u5b9e\u73b0EvictionPolicy\u91cd\u5199evict\u65b9\u6cd5 +evictionPolicyClassName=org.apache.commons.pool2.impl.DefaultEvictionPolicy + +#\u8fde\u63a5\u6700\u5927\u5b58\u6d3b\u65f6\u95f4\u3002\u975e\u6b63\u6570\u8868\u793a\u4e0d\u9650\u5236 +#\u9ed8\u8ba4-1 +maxConnLifetimeMillis=-1 + +#\u5f53\u8fbe\u5230maxConnLifetimeMillis\u88ab\u5173\u95ed\u65f6\uff0c\u662f\u5426\u6253\u5370\u76f8\u5173\u6d88\u606f +#\u9ed8\u8ba4true +#\u6ce8\u610f\uff1amaxConnLifetimeMillis\u8bbe\u7f6e\u4e3a\u6b63\u6570\u65f6\uff0c\u8fd9\u4e2a\u53c2\u6570\u624d\u6709\u6548 +logExpiredConnections=true + + +#-------------\u7f13\u5b58\u8bed\u53e5-------------------------------- +#\u662f\u5426\u7f13\u5b58PreparedStatements\uff0c\u8fd9\u4e2a\u529f\u80fd\u5728\u4e00\u4e9b\u652f\u6301\u6e38\u6807\u7684\u6570\u636e\u5e93\u4e2d\u53ef\u4ee5\u6781\u5927\u63d0\u9ad8\u6027\u80fd\uff08Oracle\u3001SQL Server\u3001DB2\u3001Sybase\uff09 +#\u9ed8\u8ba4\u4e3afalse poolPreparedStatements=false -#statement池能够同时分配的打开的statements的最大数量, 如果设置为0表示不限制 -#默认为0 -maxOpenPreparedStatements=0 - -#-------------连接泄漏回收参数-------------------------------- -#标记是否删除泄露的连接,如果他们超过了removeAbandonedTimout的限制. -#如果设置为true, 连接被认为是被泄露并且可以被删除,如果空闲时间超过removeAbandonedTimeout. -#设置为true可以为写法糟糕的没有关闭连接的程序修复数据库连接. -#默认为false -removeAbandoned=false -#泄露的连接可以被删除的超时值, 单位秒 -#默认为300 + +#\u7f13\u5b58PreparedStatements\u7684\u6700\u5927\u4e2a\u6570 +#\u9ed8\u8ba4\u4e3a-1 +#\u6ce8\u610f\uff1apoolPreparedStatements\u4e3atrue\u65f6\uff0c\u8fd9\u4e2a\u53c2\u6570\u624d\u6709\u6548 +maxOpenPreparedStatements=-1 + +#\u7f13\u5b58read-only\u548cauto-commit\u72b6\u6001\u3002\u8bbe\u7f6e\u4e3atrue\u7684\u8bdd\uff0c\u6240\u6709\u8fde\u63a5\u7684\u72b6\u6001\u90fd\u4f1a\u662f\u4e00\u6837\u7684\u3002 +#\u9ed8\u8ba4\u662ftrue +cacheState=true + + +#-------------\u4e8b\u52a1\u76f8\u5173\u7684\u5c5e\u6027-------------------------------- +#\u8fde\u63a5\u6c60\u521b\u5efa\u7684\u8fde\u63a5\u7684\u9ed8\u8ba4\u7684auto-commit\u72b6\u6001 +#\u9ed8\u8ba4\u4e3a\u7a7a\uff0c\u7531\u9a71\u52a8\u51b3\u5b9a +defaultAutoCommit=true + +#\u8fde\u63a5\u6c60\u521b\u5efa\u7684\u8fde\u63a5\u7684\u9ed8\u8ba4\u7684read-only\u72b6\u6001\u3002 +#\u9ed8\u8ba4\u503c\u4e3a\u7a7a\uff0c\u7531\u9a71\u52a8\u51b3\u5b9a +defaultReadOnly=false + +#\u8fde\u63a5\u6c60\u521b\u5efa\u7684\u8fde\u63a5\u7684\u9ed8\u8ba4\u7684TransactionIsolation\u72b6\u6001 +#\u53ef\u7528\u503c\u4e3a\u4e0b\u5217\u4e4b\u4e00\uff1aNONE,READ_UNCOMMITTED, READ_COMMITTED, REPEATABLE_READ, SERIALIZABLE +#\u9ed8\u8ba4\u503c\u4e3a\u7a7a\uff0c\u7531\u9a71\u52a8\u51b3\u5b9a +defaultTransactionIsolation=REPEATABLE_READ + +#\u5f52\u8fd8\u8fde\u63a5\u65f6\u662f\u5426\u8bbe\u7f6e\u81ea\u52a8\u63d0\u4ea4\u4e3atrue +#\u9ed8\u8ba4true +autoCommitOnReturn=true + +#\u5f52\u8fd8\u8fde\u63a5\u65f6\u662f\u5426\u8bbe\u7f6e\u56de\u6eda\u4e8b\u52a1 +#\u9ed8\u8ba4true +rollbackOnReturn=true + +#\u8fde\u63a5\u6c60\u521b\u5efa\u7684\u8fde\u63a5\u7684\u9ed8\u8ba4\u7684\u6570\u636e\u5e93\u540d +#defaultCatalog=github_demo + +#\u8fde\u63a5\u6c60\u521b\u5efa\u7684\u8fde\u63a5\u7684\u9ed8\u8ba4\u7684schema\u3002\u5982\u679c\u662fmysql\uff0c\u8fd9\u4e2a\u8bbe\u7f6e\u6ca1\u4ec0\u4e48\u7528\u3002 +#defaultSchema=github_demo + +#-------------\u8fde\u63a5\u6cc4\u6f0f\u56de\u6536\u53c2\u6570-------------------------------- +#\u5f53\u672a\u4f7f\u7528\u7684\u65f6\u95f4\u8d85\u8fc7removeAbandonedTimeout\u65f6\uff0c\u662f\u5426\u89c6\u8be5\u8fde\u63a5\u4e3a\u6cc4\u9732\u8fde\u63a5\u5e76\u5220\u9664\uff08\u5f53getConnection()\u88ab\u8c03\u7528\u65f6\u68c0\u6d4b\uff09 +#\u9ed8\u8ba4\u4e3afalse +#\u6ce8\u610f\uff1a\u8fd9\u4e2a\u673a\u5236\u5728(getNumIdle() < 2) and (getNumActive() > (getMaxActive() - 3))\u65f6\u88ab\u89e6\u53d1 +removeAbandonedOnBorrow=false + +#\u5f53\u672a\u4f7f\u7528\u7684\u65f6\u95f4\u8d85\u8fc7removeAbandonedTimeout\u65f6\uff0c\u662f\u5426\u89c6\u8be5\u8fde\u63a5\u4e3a\u6cc4\u9732\u8fde\u63a5\u5e76\u5220\u9664\uff08\u7a7a\u95f2evictor\u68c0\u6d4b\uff09 +#\u9ed8\u8ba4\u4e3afalse +#\u6ce8\u610f\uff1a\u5f53\u7a7a\u95f2\u8d44\u6e90\u56de\u6536\u5668\u5f00\u542f\u624d\u751f\u6548 +removeAbandonedOnMaintenance=false + +#\u6cc4\u9732\u7684\u8fde\u63a5\u53ef\u4ee5\u88ab\u5220\u9664\u7684\u8d85\u65f6\u503c, \u5355\u4f4d\u79d2 +#\u9ed8\u8ba4\u4e3a300 removeAbandonedTimeout=300 -#标记当Statement或连接被泄露时是否打印程序的stack traces日志。 -#被泄露的Statements和连接的日志添加在每个连接打开或者生成新的Statement,因为需要生成stack trace。 -#默认为false -logAbandoned=false -#如果开启"removeAbandoned",那么连接在被认为泄露时可能被池回收. -#这个机制在(getNumIdle() < 2) and (getNumActive() > getMaxActive() - 3)时被触发. -#举例当maxActive=20, 活动连接为18,空闲连接为1时可以触发"removeAbandoned". -#但是活动连接只有在没有被使用的时间超过"removeAbandonedTimeout"时才被删除,默认300秒.在resultset中游历不被计算为被使用. - -#-------------其他-------------------------------- -#控制PoolGuard是否容许获取底层连接 -#默认为false + +#\u6807\u8bb0\u5f53Statement\u6216\u8fde\u63a5\u88ab\u6cc4\u9732\u65f6\u662f\u5426\u6253\u5370\u7a0b\u5e8f\u7684stack traces\u65e5\u5fd7\u3002 +#\u9ed8\u8ba4\u4e3afalse +logAbandoned=true + +#\u8fd9\u4e2a\u4e0d\u662f\u5f88\u61c2 +#\u9ed8\u8ba4\u4e3afalse +abandonedUsageTracking=false + +#-------------\u5176\u4ed6-------------------------------- +#\u662f\u5426\u4f7f\u7528\u5feb\u901f\u5931\u8d25\u673a\u5236 +#\u9ed8\u8ba4\u4e3a\u7a7a\uff0c\u7531\u9a71\u52a8\u51b3\u5b9a +fastFailValidation=false + +#\u5f53\u4f7f\u7528\u5feb\u901f\u5931\u8d25\u673a\u5236\u65f6\uff0c\u8bbe\u7f6e\u89e6\u53d1\u7684\u5f02\u5e38\u7801 +#\u591a\u4e2acode\u7528","\u9694\u5f00 +#disconnectionSqlCodes + +#borrow\u8fde\u63a5\u7684\u987a\u5e8f +#\u9ed8\u8ba4true +lifo=true + +#\u6bcf\u4e2a\u8fde\u63a5\u521b\u5efa\u65f6\u6267\u884c\u7684\u8bed\u53e5 +#connectionInitSqls= + +#\u8fde\u63a5\u53c2\u6570\uff1a\u4f8b\u5982username\u3001password\u3001characterEncoding\u7b49\u90fd\u53ef\u4ee5\u5728\u8fd9\u91cc\u8bbe\u7f6e +#\u591a\u4e2a\u53c2\u6570\u7528";"\u9694\u5f00 +#connectionProperties= + +#\u6307\u5b9a\u6570\u636e\u6e90\u7684jmx\u540d +#jmxName= + +#\u67e5\u8be2\u8d85\u65f6\u65f6\u95f4 +#\u9ed8\u8ba4\u4e3a\u7a7a\uff0c\u5373\u6839\u636e\u9a71\u52a8\u8bbe\u7f6e +#defaultQueryTimeout= + +#\u63a7\u5236PoolGuard\u662f\u5426\u5bb9\u8bb8\u83b7\u53d6\u5e95\u5c42\u8fde\u63a5 +#\u9ed8\u8ba4\u4e3afalse accessToUnderlyingConnectionAllowed=false -#如果容许则可以使用下面的方式来获取底层物理连接: + +#\u5982\u679c\u5bb9\u8bb8\u5219\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u65b9\u5f0f\u6765\u83b7\u53d6\u5e95\u5c42\u7269\u7406\u8fde\u63a5: # Connection conn = ds.getConnection(); # Connection dconn = ((DelegatingConnection) conn).getInnermostDelegate(); # ... diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties index 393e598..c38440f 100644 --- a/src/main/resources/log4j.properties +++ b/src/main/resources/log4j.properties @@ -1,12 +1,10 @@ #OFF,systemOut,logFile,logDailyFile,logRollingFile,logMail,logDB,ALL -#①配置根Logger -log4j.rootLogger=debug,systemOut -#OFF,systemOut,logFile,logDailyFile,logRollingFile,logMail,logDB,ALL -#②配置其他Logger -#log4j.logger.myLogger=debug,systemOut -#log4j.additivity.mobileLogger=false +#\u2460\u914d\u7f6e\u6839Logger +log4j.rootLogger=info,systemOut +log4j.logger.cn.zzs.dbcp=debug,systemOut +log4j.additivity.cn.zzs.dbcp=false -#输出到控制台 +#\u8f93\u51fa\u5230\u63a7\u5236\u53f0 log4j.appender.systemOut= org.apache.log4j.ConsoleAppender log4j.appender.systemOut.layout= org.apache.log4j.PatternLayout log4j.appender.systemOut.layout.ConversionPattern=[%p][Thread:%t]: %m%n @@ -14,7 +12,7 @@ log4j.appender.systemOut.Threshold= debug log4j.appender.systemOut.ImmediateFlush= TRUE log4j.appender.systemOut.Target= System.out -#输出到文件 +#\u8f93\u51fa\u5230\u6587\u4ef6 log4j.appender.logFile= org.apache.log4j.FileAppender log4j.appender.logFile.layout= org.apache.log4j.PatternLayout log4j.appender.logFile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss a} [Thread:%t][Class:%c Method: %M]%n%p: %m%n @@ -24,7 +22,7 @@ log4j.appender.logFile.Append= TRUE log4j.appender.logFile.File= logs/file_log.log log4j.appender.logFile.Encoding= utf-8 -#按DatePattern输出到文件 +#\u6309DatePattern\u8f93\u51fa\u5230\u6587\u4ef6 log4j.appender.logDailyFile= org.apache.log4j.DailyRollingFileAppender log4j.appender.logDailyFile.layout= org.apache.log4j.PatternLayout log4j.appender.logDailyFile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss a} [Thread:%t][Class:%c Method: %M]%n%p: %m%n @@ -36,7 +34,7 @@ log4j.appender.logDailyFile.File= logs/daily_log log4j.appender.logDailyFile.DatePattern= '_'yyyy-MM-dd-HH-mm'.log' log4j.appender.logDailyFile.Encoding= utf-8 -#设定文件大小输出到文件 +#\u8bbe\u5b9a\u6587\u4ef6\u5927\u5c0f\u8f93\u51fa\u5230\u6587\u4ef6 log4j.appender.logRollingFile= org.apache.log4j.RollingFileAppender log4j.appender.logRollingFile.layout= org.apache.log4j.PatternLayout log4j.appender.logRollingFile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss a} [Thread:%t][Class:%c Method: %M]%n%p: %m%n @@ -48,7 +46,7 @@ log4j.appender.logRollingFile.MaxFileSize= 1mb log4j.appender.logRollingFile.MaxBackupIndex= 10 log4j.appender.logRollingFile.Encoding= utf-8 -#用Email发送日志 +#\u7528Email\u53d1\u9001\u65e5\u5fd7 log4j.appender.logMail= org.apache.log4j.net.SMTPAppender log4j.appender.logMail.layout= org.apache.log4j.HTMLLayout log4j.appender.logMail.layout.LocationInfo= TRUE @@ -66,7 +64,7 @@ log4j.appender.logMail.Subject= Log4j Log Messages #log4j.appender.logMail.BufferSize= 1024 #log4j.appender.logMail.SMTPAuth= TRUE -#将日志登录到MySQL数据库 +#\u5c06\u65e5\u5fd7\u767b\u5f55\u5230MySQL\u6570\u636e\u5e93 log4j.appender.logDB= org.apache.log4j.jdbc.JDBCAppender log4j.appender.logDB.layout= org.apache.log4j.PatternLayout log4j.appender.logDB.Driver= com.mysql.cj.jdbc.Driver @@ -75,109 +73,109 @@ log4j.appender.logDB.User= root log4j.appender.logDB.Password= root log4j.appender.logDB.Sql= INSERT INTO T_log4j(project_name,create_date,level,category,file_name,thread_name,line,all_category,message)values('Struts2','%d{yyyy-MM-ddHH:mm:ss}','%p','%c','%F','%t','%L','%l','%m') ################################################################################ -#①配置根Logger,其语法为: +#\u2460\u914d\u7f6e\u6839Logger\uff0c\u5176\u8bed\u6cd5\u4e3a\uff1a # #log4j.rootLogger =[level],appenderName,appenderName2,... -#level是日志记录的优先级,分为OFF,TRACE,DEBUG,INFO,WARN,ERROR,FATAL,ALL -##Log4j建议只使用四个级别,优先级从低到高分别是DEBUG,INFO,WARN,ERROR -#通过在这里定义的级别,您可以控制到应用程序中相应级别的日志信息的开关 -#比如在这里定义了INFO级别,则应用程序中所有DEBUG级别的日志信息将不被打印出来 -#appenderName就是指定日志信息输出到哪个地方。可同时指定多个输出目的 +#level\u662f\u65e5\u5fd7\u8bb0\u5f55\u7684\u4f18\u5148\u7ea7\uff0c\u5206\u4e3aOFF,TRACE,DEBUG,INFO,WARN,ERROR,FATAL,ALL +##Log4j\u5efa\u8bae\u53ea\u4f7f\u7528\u56db\u4e2a\u7ea7\u522b\uff0c\u4f18\u5148\u7ea7\u4ece\u4f4e\u5230\u9ad8\u5206\u522b\u662fDEBUG,INFO,WARN,ERROR +#\u901a\u8fc7\u5728\u8fd9\u91cc\u5b9a\u4e49\u7684\u7ea7\u522b\uff0c\u60a8\u53ef\u4ee5\u63a7\u5236\u5230\u5e94\u7528\u7a0b\u5e8f\u4e2d\u76f8\u5e94\u7ea7\u522b\u7684\u65e5\u5fd7\u4fe1\u606f\u7684\u5f00\u5173 +#\u6bd4\u5982\u5728\u8fd9\u91cc\u5b9a\u4e49\u4e86INFO\u7ea7\u522b\uff0c\u5219\u5e94\u7528\u7a0b\u5e8f\u4e2d\u6240\u6709DEBUG\u7ea7\u522b\u7684\u65e5\u5fd7\u4fe1\u606f\u5c06\u4e0d\u88ab\u6253\u5370\u51fa\u6765 +#appenderName\u5c31\u662f\u6307\u5b9a\u65e5\u5fd7\u4fe1\u606f\u8f93\u51fa\u5230\u54ea\u4e2a\u5730\u65b9\u3002\u53ef\u540c\u65f6\u6307\u5b9a\u591a\u4e2a\u8f93\u51fa\u76ee\u7684 ################################################################################ ################################################################################ -#②配置日志信息输出目的地Appender,其语法为: +#\u2461\u914d\u7f6e\u65e5\u5fd7\u4fe1\u606f\u8f93\u51fa\u76ee\u7684\u5730Appender\uff0c\u5176\u8bed\u6cd5\u4e3a\uff1a # #log4j.appender.appenderName =fully.qualified.name.of.appender.class #log4j.appender.appenderName.optionN =valueN # -#Log4j提供的appender有以下几种: -#1)org.apache.log4j.ConsoleAppender(输出到控制台) -#2)org.apache.log4j.FileAppender(输出到文件) -#3)org.apache.log4j.DailyRollingFileAppender(每天产生一个日志文件) -#4)org.apache.log4j.RollingFileAppender(文件大小到达指定尺寸的时候产生一个新的文件) -#5)org.apache.log4j.WriterAppender(将日志信息以流格式发送到任意指定的地方) +#Log4j\u63d0\u4f9b\u7684appender\u6709\u4ee5\u4e0b\u51e0\u79cd\uff1a +#1)org.apache.log4j.ConsoleAppender(\u8f93\u51fa\u5230\u63a7\u5236\u53f0) +#2)org.apache.log4j.FileAppender(\u8f93\u51fa\u5230\u6587\u4ef6) +#3)org.apache.log4j.DailyRollingFileAppender(\u6bcf\u5929\u4ea7\u751f\u4e00\u4e2a\u65e5\u5fd7\u6587\u4ef6) +#4)org.apache.log4j.RollingFileAppender(\u6587\u4ef6\u5927\u5c0f\u5230\u8fbe\u6307\u5b9a\u5c3a\u5bf8\u7684\u65f6\u5019\u4ea7\u751f\u4e00\u4e2a\u65b0\u7684\u6587\u4ef6) +#5)org.apache.log4j.WriterAppender(\u5c06\u65e5\u5fd7\u4fe1\u606f\u4ee5\u6d41\u683c\u5f0f\u53d1\u9001\u5230\u4efb\u610f\u6307\u5b9a\u7684\u5730\u65b9) # -#1)ConsoleAppender选项属性 -# -Threshold = DEBUG:指定日志消息的输出最低层次 -# -ImmediateFlush = TRUE:默认值是true,所有的消息都会被立即输出 -# -Target = System.err:默认值System.out,输出到控制台(err为红色,out为黑色) +#1)ConsoleAppender\u9009\u9879\u5c5e\u6027 +# -Threshold = DEBUG:\u6307\u5b9a\u65e5\u5fd7\u6d88\u606f\u7684\u8f93\u51fa\u6700\u4f4e\u5c42\u6b21 +# -ImmediateFlush = TRUE:\u9ed8\u8ba4\u503c\u662ftrue,\u6240\u6709\u7684\u6d88\u606f\u90fd\u4f1a\u88ab\u7acb\u5373\u8f93\u51fa +# -Target = System.err:\u9ed8\u8ba4\u503cSystem.out,\u8f93\u51fa\u5230\u63a7\u5236\u53f0(err\u4e3a\u7ea2\u8272,out\u4e3a\u9ed1\u8272) # -#2)FileAppender选项属性 -# -Threshold = INFO:指定日志消息的输出最低层次 -# -ImmediateFlush = TRUE:默认值是true,所有的消息都会被立即输出 -# -File = C:\log4j.log:指定消息输出到C:\log4j.log文件 -# -Append = FALSE:默认值true,将消息追加到指定文件中,false指将消息覆盖指定的文件内容 -# -Encoding = UTF-8:可以指定文件编码格式 +#2)FileAppender\u9009\u9879\u5c5e\u6027 +# -Threshold = INFO:\u6307\u5b9a\u65e5\u5fd7\u6d88\u606f\u7684\u8f93\u51fa\u6700\u4f4e\u5c42\u6b21 +# -ImmediateFlush = TRUE:\u9ed8\u8ba4\u503c\u662ftrue,\u6240\u6709\u7684\u6d88\u606f\u90fd\u4f1a\u88ab\u7acb\u5373\u8f93\u51fa +# -File = C:\log4j.log:\u6307\u5b9a\u6d88\u606f\u8f93\u51fa\u5230C:\log4j.log\u6587\u4ef6 +# -Append = FALSE:\u9ed8\u8ba4\u503ctrue,\u5c06\u6d88\u606f\u8ffd\u52a0\u5230\u6307\u5b9a\u6587\u4ef6\u4e2d\uff0cfalse\u6307\u5c06\u6d88\u606f\u8986\u76d6\u6307\u5b9a\u7684\u6587\u4ef6\u5185\u5bb9 +# -Encoding = UTF-8:\u53ef\u4ee5\u6307\u5b9a\u6587\u4ef6\u7f16\u7801\u683c\u5f0f # -#3)DailyRollingFileAppender选项属性 -#-Threshold = WARN:指定日志消息的输出最低层次 -#-ImmediateFlush = TRUE:默认值是true,所有的消息都会被立即输出 -# -File =C:\log4j.log:指定消息输出到C:\log4j.log文件 -# -Append= FALSE:默认值true,将消息追加到指定文件中,false指将消息覆盖指定的文件内容 -#-DatePattern='.'yyyy-ww:每周滚动一次文件,即每周产生一个新的文件。还可以按用以下参数: -# '.'yyyy-MM:每月 -# '.'yyyy-ww:每周 -# '.'yyyy-MM-dd:每天 -# '.'yyyy-MM-dd-a:每天两次 -# '.'yyyy-MM-dd-HH:每小时 -# '.'yyyy-MM-dd-HH-mm:每分钟 -#-Encoding = UTF-8:可以指定文件编码格式 +#3)DailyRollingFileAppender\u9009\u9879\u5c5e\u6027 +#-Threshold = WARN:\u6307\u5b9a\u65e5\u5fd7\u6d88\u606f\u7684\u8f93\u51fa\u6700\u4f4e\u5c42\u6b21 +#-ImmediateFlush = TRUE:\u9ed8\u8ba4\u503c\u662ftrue,\u6240\u6709\u7684\u6d88\u606f\u90fd\u4f1a\u88ab\u7acb\u5373\u8f93\u51fa +# -File =C:\log4j.log:\u6307\u5b9a\u6d88\u606f\u8f93\u51fa\u5230C:\log4j.log\u6587\u4ef6 +# -Append= FALSE:\u9ed8\u8ba4\u503ctrue,\u5c06\u6d88\u606f\u8ffd\u52a0\u5230\u6307\u5b9a\u6587\u4ef6\u4e2d\uff0cfalse\u6307\u5c06\u6d88\u606f\u8986\u76d6\u6307\u5b9a\u7684\u6587\u4ef6\u5185\u5bb9 +#-DatePattern='.'yyyy-ww:\u6bcf\u5468\u6eda\u52a8\u4e00\u6b21\u6587\u4ef6,\u5373\u6bcf\u5468\u4ea7\u751f\u4e00\u4e2a\u65b0\u7684\u6587\u4ef6\u3002\u8fd8\u53ef\u4ee5\u6309\u7528\u4ee5\u4e0b\u53c2\u6570: +# '.'yyyy-MM:\u6bcf\u6708 +# '.'yyyy-ww:\u6bcf\u5468 +# '.'yyyy-MM-dd:\u6bcf\u5929 +# '.'yyyy-MM-dd-a:\u6bcf\u5929\u4e24\u6b21 +# '.'yyyy-MM-dd-HH:\u6bcf\u5c0f\u65f6 +# '.'yyyy-MM-dd-HH-mm:\u6bcf\u5206\u949f +#-Encoding = UTF-8:\u53ef\u4ee5\u6307\u5b9a\u6587\u4ef6\u7f16\u7801\u683c\u5f0f # -#4)RollingFileAppender选项属性 -#-Threshold = ERROR:指定日志消息的输出最低层次 -#-ImmediateFlush = TRUE:默认值是true,所有的消息都会被立即输出 -# -File =C:/log4j.log:指定消息输出到C:/log4j.log文件 -# -Append= FALSE:默认值true,将消息追加到指定文件中,false指将消息覆盖指定的文件内容 -#-MaxFileSize = 100KB:后缀可以是KB,MB,GB.在日志文件到达该大小时,将会自动滚动.如:log4j.log.1 -#-MaxBackupIndex = 2:指定可以产生的滚动文件的最大数 -#-Encoding = UTF-8:可以指定文件编码格式 +#4)RollingFileAppender\u9009\u9879\u5c5e\u6027 +#-Threshold = ERROR:\u6307\u5b9a\u65e5\u5fd7\u6d88\u606f\u7684\u8f93\u51fa\u6700\u4f4e\u5c42\u6b21 +#-ImmediateFlush = TRUE:\u9ed8\u8ba4\u503c\u662ftrue,\u6240\u6709\u7684\u6d88\u606f\u90fd\u4f1a\u88ab\u7acb\u5373\u8f93\u51fa +# -File =C:/log4j.log:\u6307\u5b9a\u6d88\u606f\u8f93\u51fa\u5230C:/log4j.log\u6587\u4ef6 +# -Append= FALSE:\u9ed8\u8ba4\u503ctrue,\u5c06\u6d88\u606f\u8ffd\u52a0\u5230\u6307\u5b9a\u6587\u4ef6\u4e2d\uff0cfalse\u6307\u5c06\u6d88\u606f\u8986\u76d6\u6307\u5b9a\u7684\u6587\u4ef6\u5185\u5bb9 +#-MaxFileSize = 100KB:\u540e\u7f00\u53ef\u4ee5\u662fKB,MB,GB.\u5728\u65e5\u5fd7\u6587\u4ef6\u5230\u8fbe\u8be5\u5927\u5c0f\u65f6,\u5c06\u4f1a\u81ea\u52a8\u6eda\u52a8.\u5982:log4j.log.1 +#-MaxBackupIndex = 2:\u6307\u5b9a\u53ef\u4ee5\u4ea7\u751f\u7684\u6eda\u52a8\u6587\u4ef6\u7684\u6700\u5927\u6570 +#-Encoding = UTF-8:\u53ef\u4ee5\u6307\u5b9a\u6587\u4ef6\u7f16\u7801\u683c\u5f0f ################################################################################ ################################################################################ -#③配置日志信息的格式(布局),其语法为: +#\u2462\u914d\u7f6e\u65e5\u5fd7\u4fe1\u606f\u7684\u683c\u5f0f(\u5e03\u5c40)\uff0c\u5176\u8bed\u6cd5\u4e3a\uff1a # #log4j.appender.appenderName.layout=fully.qualified.name.of.layout.class #log4j.appender.appenderName.layout.optionN= valueN # -#Log4j提供的layout有以下几种: -#5)org.apache.log4j.HTMLLayout(以HTML表格形式布局) -#6)org.apache.log4j.PatternLayout(可以灵活地指定布局模式) -#7)org.apache.log4j.SimpleLayout(包含日志信息的级别和信息字符串) -#8)org.apache.log4j.TTCCLayout(包含日志产生的时间、线程、类别等等信息) -#9)org.apache.log4j.xml.XMLLayout(以XML形式布局) +#Log4j\u63d0\u4f9b\u7684layout\u6709\u4ee5\u4e0b\u51e0\u79cd\uff1a +#5)org.apache.log4j.HTMLLayout(\u4ee5HTML\u8868\u683c\u5f62\u5f0f\u5e03\u5c40) +#6)org.apache.log4j.PatternLayout(\u53ef\u4ee5\u7075\u6d3b\u5730\u6307\u5b9a\u5e03\u5c40\u6a21\u5f0f) +#7)org.apache.log4j.SimpleLayout(\u5305\u542b\u65e5\u5fd7\u4fe1\u606f\u7684\u7ea7\u522b\u548c\u4fe1\u606f\u5b57\u7b26\u4e32) +#8)org.apache.log4j.TTCCLayout(\u5305\u542b\u65e5\u5fd7\u4ea7\u751f\u7684\u65f6\u95f4\u3001\u7ebf\u7a0b\u3001\u7c7b\u522b\u7b49\u7b49\u4fe1\u606f) +#9)org.apache.log4j.xml.XMLLayout(\u4ee5XML\u5f62\u5f0f\u5e03\u5c40) # -#5)HTMLLayout选项属性 -#-LocationInfo = TRUE:默认值false,输出java文件名称和行号 -#-Title=Struts Log Message:默认值 Log4JLog Messages +#5)HTMLLayout\u9009\u9879\u5c5e\u6027 +#-LocationInfo = TRUE:\u9ed8\u8ba4\u503cfalse,\u8f93\u51fajava\u6587\u4ef6\u540d\u79f0\u548c\u884c\u53f7 +#-Title=Struts Log Message:\u9ed8\u8ba4\u503c Log4JLog Messages # -#6)PatternLayout选项属性 -#-ConversionPattern = %m%n:格式化指定的消息(参数意思下面有) +#6)PatternLayout\u9009\u9879\u5c5e\u6027 +#-ConversionPattern = %m%n:\u683c\u5f0f\u5316\u6307\u5b9a\u7684\u6d88\u606f(\u53c2\u6570\u610f\u601d\u4e0b\u9762\u6709) # -#9)XMLLayout选项属性 -#-LocationInfo = TRUE:默认值false,输出java文件名称和行号 +#9)XMLLayout\u9009\u9879\u5c5e\u6027 +#-LocationInfo = TRUE:\u9ed8\u8ba4\u503cfalse,\u8f93\u51fajava\u6587\u4ef6\u540d\u79f0\u548c\u884c\u53f7 # -#Log4J采用类似C语言中的printf函数的打印格式格式化日志信息,打印参数如下: -#%m 输出代码中指定的消息 -#%p 输出优先级,即DEBUG,INFO,WARN,ERROR,FATAL -#%r 输出自应用启动到输出该log信息耗费的毫秒数 -#%c 输出所属的类目,通常就是所在类的全名 -#%t 输出产生该日志事件的线程名 -#%n 输出一个回车换行符,Windows平台为“\r\n”,Unix平台为“\n” -#%d 输出日志时间点的日期或时间,默认格式为ISO8601,也可以在其后指定格式 -# 如:%d{yyyy年MM月dd日HH:mm:ss,SSS},输出类似:2012年01月05日 22:10:28,921 -#%l 输出日志事件的发生位置,包括类目名、发生的线程,以及在代码中的行数 -# 如:Testlog.main(TestLog.java:10) -#%F 输出日志消息产生时所在的文件名称 -#%L 输出代码中的行号 -#%x 输出和当前线程相关联的NDC(嵌套诊断环境),像javaservlets多客户多线程的应用中 -#%% 输出一个"%"字符 +#Log4J\u91c7\u7528\u7c7b\u4f3cC\u8bed\u8a00\u4e2d\u7684printf\u51fd\u6570\u7684\u6253\u5370\u683c\u5f0f\u683c\u5f0f\u5316\u65e5\u5fd7\u4fe1\u606f\uff0c\u6253\u5370\u53c2\u6570\u5982\u4e0b\uff1a +#%m \u8f93\u51fa\u4ee3\u7801\u4e2d\u6307\u5b9a\u7684\u6d88\u606f +#%p \u8f93\u51fa\u4f18\u5148\u7ea7\uff0c\u5373DEBUG,INFO,WARN,ERROR,FATAL +#%r \u8f93\u51fa\u81ea\u5e94\u7528\u542f\u52a8\u5230\u8f93\u51fa\u8be5log\u4fe1\u606f\u8017\u8d39\u7684\u6beb\u79d2\u6570 +#%c \u8f93\u51fa\u6240\u5c5e\u7684\u7c7b\u76ee,\u901a\u5e38\u5c31\u662f\u6240\u5728\u7c7b\u7684\u5168\u540d +#%t \u8f93\u51fa\u4ea7\u751f\u8be5\u65e5\u5fd7\u4e8b\u4ef6\u7684\u7ebf\u7a0b\u540d +#%n \u8f93\u51fa\u4e00\u4e2a\u56de\u8f66\u6362\u884c\u7b26\uff0cWindows\u5e73\u53f0\u4e3a\u201c\r\n\u201d\uff0cUnix\u5e73\u53f0\u4e3a\u201c\n\u201d +#%d \u8f93\u51fa\u65e5\u5fd7\u65f6\u95f4\u70b9\u7684\u65e5\u671f\u6216\u65f6\u95f4\uff0c\u9ed8\u8ba4\u683c\u5f0f\u4e3aISO8601\uff0c\u4e5f\u53ef\u4ee5\u5728\u5176\u540e\u6307\u5b9a\u683c\u5f0f +# \u5982\uff1a%d{yyyy\u5e74MM\u6708dd\u65e5HH:mm:ss,SSS}\uff0c\u8f93\u51fa\u7c7b\u4f3c\uff1a2012\u5e7401\u670805\u65e5 22:10:28,921 +#%l \u8f93\u51fa\u65e5\u5fd7\u4e8b\u4ef6\u7684\u53d1\u751f\u4f4d\u7f6e\uff0c\u5305\u62ec\u7c7b\u76ee\u540d\u3001\u53d1\u751f\u7684\u7ebf\u7a0b\uff0c\u4ee5\u53ca\u5728\u4ee3\u7801\u4e2d\u7684\u884c\u6570 +# \u5982\uff1aTestlog.main(TestLog.java:10) +#%F \u8f93\u51fa\u65e5\u5fd7\u6d88\u606f\u4ea7\u751f\u65f6\u6240\u5728\u7684\u6587\u4ef6\u540d\u79f0 +#%L \u8f93\u51fa\u4ee3\u7801\u4e2d\u7684\u884c\u53f7 +#%x \u8f93\u51fa\u548c\u5f53\u524d\u7ebf\u7a0b\u76f8\u5173\u8054\u7684NDC(\u5d4c\u5957\u8bca\u65ad\u73af\u5883),\u50cfjavaservlets\u591a\u5ba2\u6237\u591a\u7ebf\u7a0b\u7684\u5e94\u7528\u4e2d +#%% \u8f93\u51fa\u4e00\u4e2a"%"\u5b57\u7b26 # -# 可以在%与模式字符之间加上修饰符来控制其最小宽度、最大宽度、和文本的对齐方式。如: -# %5c: 输出category名称,最小宽度是5,category<5,默认的情况下右对齐 -# %-5c:输出category名称,最小宽度是5,category<5,"-"号指定左对齐,会有空格 -# %.5c:输出category名称,最大宽度是5,category>5,就会将左边多出的字符截掉,<5不会有空格 -# %20.30c:category名称<20补空格,并且右对齐,>30字符,就从左边交远销出的字符截掉 +# \u53ef\u4ee5\u5728%\u4e0e\u6a21\u5f0f\u5b57\u7b26\u4e4b\u95f4\u52a0\u4e0a\u4fee\u9970\u7b26\u6765\u63a7\u5236\u5176\u6700\u5c0f\u5bbd\u5ea6\u3001\u6700\u5927\u5bbd\u5ea6\u3001\u548c\u6587\u672c\u7684\u5bf9\u9f50\u65b9\u5f0f\u3002\u5982\uff1a +# %5c: \u8f93\u51facategory\u540d\u79f0\uff0c\u6700\u5c0f\u5bbd\u5ea6\u662f5\uff0ccategory<5\uff0c\u9ed8\u8ba4\u7684\u60c5\u51b5\u4e0b\u53f3\u5bf9\u9f50 +# %-5c:\u8f93\u51facategory\u540d\u79f0\uff0c\u6700\u5c0f\u5bbd\u5ea6\u662f5\uff0ccategory<5\uff0c"-"\u53f7\u6307\u5b9a\u5de6\u5bf9\u9f50,\u4f1a\u6709\u7a7a\u683c +# %.5c:\u8f93\u51facategory\u540d\u79f0\uff0c\u6700\u5927\u5bbd\u5ea6\u662f5\uff0ccategory>5\uff0c\u5c31\u4f1a\u5c06\u5de6\u8fb9\u591a\u51fa\u7684\u5b57\u7b26\u622a\u6389\uff0c<5\u4e0d\u4f1a\u6709\u7a7a\u683c +# %20.30c:category\u540d\u79f0<20\u8865\u7a7a\u683c\uff0c\u5e76\u4e14\u53f3\u5bf9\u9f50\uff0c>30\u5b57\u7b26\uff0c\u5c31\u4ece\u5de6\u8fb9\u4ea4\u8fdc\u9500\u51fa\u7684\u5b57\u7b26\u622a\u6389 ################################################################################ ################################################################################ -#④指定特定包的输出特定的级别 +#\u2463\u6307\u5b9a\u7279\u5b9a\u5305\u7684\u8f93\u51fa\u7279\u5b9a\u7684\u7ea7\u522b #log4j.logger.org.springframework=DEBUG ################################################################################ \ No newline at end of file diff --git a/src/main/resources/sql/demo_user.sql b/src/main/resources/sql/demo_user.sql new file mode 100644 index 0000000..18dbb23 --- /dev/null +++ b/src/main/resources/sql/demo_user.sql @@ -0,0 +1,45 @@ + +CREATE DATABASE `github_demo` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; + +USE `github_demo`; + +DROP TABLE IF EXISTS `demo_user`; + +CREATE TABLE `demo_user` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '用户id', + `name` varchar(16) COLLATE utf8_unicode_ci NOT NULL COMMENT '用户名', + `age` int(3) unsigned DEFAULT NULL COMMENT '用户年龄', + `gmt_create` datetime DEFAULT NULL COMMENT '记录创建时间', + `gmt_modified` datetime DEFAULT NULL COMMENT '记录最近修改时间', + `deleted` bit(1) DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_name` (`name`), + KEY `index_age` (`age`) +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + + +insert into `demo_user`( + `id`, `name`, `age`, `gmt_create`, + `gmt_modified`, `deleted` +) +values + ( + 1, 'zzs001', 18, '2019-10-01 11:13:42', + '2019-11-01 11:13:50', '\0' + ), + ( + 2, 'zzs002', 18, '2019-11-23 00:00:00', + '2019-11-23 00:00:00', '\0' + ), + ( + 3, 'zzs003', 25, '2019-11-01 11:14:36', + '2019-11-03 00:00:00', '\0' + ), + ( + 4, 'zzf001', 26, '2019-11-04 11:14:51', + '2019-11-03 00:00:00', '\0' + ), + ( + 5, 'zzf002', 17, '2019-11-03 00:00:00', + '2019-11-03 00:00:00', '\0' + ); \ No newline at end of file diff --git a/src/test/java/cn/zzs/dbcp/BasicDataSourceTest.java b/src/test/java/cn/zzs/dbcp/BasicDataSourceTest.java new file mode 100644 index 0000000..e6d6bf1 --- /dev/null +++ b/src/test/java/cn/zzs/dbcp/BasicDataSourceTest.java @@ -0,0 +1,152 @@ +package cn.zzs.dbcp; + +import java.sql.Connection; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.junit.Test; + +/** + * @ClassName: BasicDataSourceTest + * @Description: 测试使用BasicDataSource获取连接并操作数据库 + * @author: zzs + * @date: 2019年8月31日 下午9:39:54 + */ +public class BasicDataSourceTest { + + private static final Log log = LogFactory.getLog(BasicDataSourceTest.class); + + /** + * 测试添加用户 + */ + @Test + public void save() { + // 创建sql + String sql = "insert into demo_user values(null,?,?,?,?,?)"; + Connection connection = null; + PreparedStatement statement = null; + try { + // 获得连接 + connection = BasicDataSourceUtil.getConnection(); + // 开启事务设置非自动提交 + BasicDataSourceUtil.startTrasaction(); + // 获得Statement对象 + statement = connection.prepareStatement(sql); + // 设置参数 + statement.setString(1, "zzf003"); + statement.setInt(2, 18); + statement.setDate(3, new Date(System.currentTimeMillis())); + statement.setDate(4, new Date(System.currentTimeMillis())); + statement.setBoolean(5, false); + // 执行 + statement.executeUpdate(); + // 提交事务 + BasicDataSourceUtil.commit(); + } catch(Exception e) { + BasicDataSourceUtil.rollback(); + log.error("保存用户失败", e); + } finally { + // 释放资源 + BasicDataSourceUtil.release(connection, statement, null); + } + } + + /** + * 测试更新用户 + */ + @Test + public void update() { + // 创建sql + String sql = "update demo_user set age = ?,gmt_modified = ? where name = ?"; + Connection connection = null; + PreparedStatement statement = null; + try { + // 获得连接 + connection = BasicDataSourceUtil.getConnection(); + // 开启事务 + BasicDataSourceUtil.startTrasaction(); + // 获得Statement对象 + statement = connection.prepareStatement(sql); + // 设置参数 + statement.setInt(1, 19); + statement.setDate(2, new Date(System.currentTimeMillis())); + statement.setString(3, "zzf003"); + // 执行 + statement.executeUpdate(); + // 提交事务 + BasicDataSourceUtil.commit(); + } catch(Exception e) { + log.error("异常导致操作回滚", e); + BasicDataSourceUtil.rollback(); + } finally { + // 释放资源 + BasicDataSourceUtil.release(connection, statement, null); + } + } + + /** + * 测试查找用户 + */ + @Test + public void findAll() { + // 创建sql + String sql = "select * from demo_user where deleted = false"; + Connection connection = null; + PreparedStatement statement = null; + ResultSet resultSet = null; + try { + // 获得连接 + connection = BasicDataSourceUtil.getConnection(); + // 获得Statement对象 + statement = connection.prepareStatement(sql); + // 执行 + resultSet = statement.executeQuery(); + // 遍历结果集 + while(resultSet.next()) { + String name = resultSet.getString(2); + int age = resultSet.getInt(3); + System.out.println("用户名:" + name + ",年龄:" + age); + } + } catch(SQLException e) { + log.error("查询用户异常", e); + } finally { + // 释放资源 + BasicDataSourceUtil.release(connection, statement, resultSet); + } + } + + /** + * 测试删除用户 + */ + @Test + public void delete() throws Exception { + // 创建sql + String sql = "delete from demo_user where name = ?"; + Connection connection = null; + PreparedStatement statement = null; + try { + // 获得连接 + connection = BasicDataSourceUtil.getConnection(); + // 设置非自动提交 + BasicDataSourceUtil.startTrasaction(); + // 获得Statement对象 + statement = connection.prepareStatement(sql); + // 设置参数 + statement.setString(1, "zzf003"); + // 执行 + statement.executeUpdate(); + // 提交事务 + BasicDataSourceUtil.commit(); + } catch(Exception e) { + log.error("异常导致操作回滚", e); + BasicDataSourceUtil.rollback(); + } finally { + // 释放资源 + BasicDataSourceUtil.release(connection, statement, null); + } + } +} diff --git a/src/test/java/cn/zzs/dbcp/DBCPTest.java b/src/test/java/cn/zzs/dbcp/DBCPTest.java deleted file mode 100644 index 98053b3..0000000 --- a/src/test/java/cn/zzs/dbcp/DBCPTest.java +++ /dev/null @@ -1,146 +0,0 @@ -package cn.zzs.dbcp; - -import java.sql.Connection; -import java.sql.Date; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.junit.Test; - -/** - * @ClassName: DBCPTest - * @Description: 测试DBCP - * @author: zzs - * @date: 2019年8月31日 下午9:39:54 - */ -public class DBCPTest { - /** - * 测试添加用户 - * @throws SQLException - */ - @Test - public void saveUser() throws Exception { - //创建sql - String sql = "insert into user values(null,?,?,?,?)"; - //获得连接 - Connection connection = JDBCUtil.getConnection(); - PreparedStatement statement = null; - try { - //设置非自动提交 - connection.setAutoCommit(false); - //获得Statement对象 - statement = connection.prepareStatement(sql); - //设置参数 - statement.setString(1, "zzs001"); - statement.setInt(2, 18); - statement.setDate(3, new Date(System.currentTimeMillis())); - statement.setDate(4, new Date(System.currentTimeMillis())); - //执行 - statement.executeUpdate(); - //提交事务 - connection.commit(); - } catch (Exception e) { - System.out.println("异常导致操作回滚"); - connection.rollback(); - e.printStackTrace(); - } finally { - //释放资源 - JDBCUtil.release(connection, statement,null); - } - } - - /** - * 测试更新用户 - */ - @Test - public void updateUser() throws Exception { - //创建sql - String sql = "update user set age = ?,gmt_modified = ? where name = ?"; - //获得连接 - Connection connection = JDBCUtil.getConnection(); - PreparedStatement statement = null; - try { - //设置非自动提交 - connection.setAutoCommit(false); - //获得Statement对象 - statement = connection.prepareStatement(sql); - //设置参数 - statement.setInt(1, 19); - statement.setDate(2, new Date(System.currentTimeMillis())); - statement.setString(3, "zzs001"); - //执行 - statement.executeUpdate(); - //提交事务 - connection.commit(); - } catch (Exception e) { - System.out.println("异常导致操作回滚"); - connection.rollback(); - e.printStackTrace(); - } finally { - //释放资源 - JDBCUtil.release(connection, statement,null); - } - } - - /** - * 测试查找用户 - */ - @Test - public void findUser() throws Exception { - //创建sql - String sql = "select * from user where name = ?"; - //获得连接 - Connection connection = JDBCUtil.getConnection(); - PreparedStatement statement = null; - ResultSet resultSet = null; - try { - //获得Statement对象 - statement = connection.prepareStatement(sql); - //设置参数 - statement.setString(1, "zzs001"); - //执行 - resultSet = statement.executeQuery(); - //遍历结果集 - while (resultSet.next()) { - String name = resultSet.getString(2); - int age = resultSet.getInt(3); - System.out.println("用户名:" + name + ",年龄:" + age); - } - } finally { - //释放资源 - JDBCUtil.release(connection, statement,resultSet); - } - } - - /** - * 测试删除用户 - */ - @Test - public void deleteUser() throws Exception { - //创建sql - String sql = "delete from user where name = ?"; - //获得连接 - Connection connection = JDBCUtil.getConnection(); - PreparedStatement statement = null; - try { - //设置非自动提交 - connection.setAutoCommit(false); - //获得Statement对象 - statement = connection.prepareStatement(sql); - //设置参数 - statement.setString(1, "zzs001"); - //执行 - statement.executeUpdate(); - //提交事务 - connection.commit(); - } catch (Exception e) { - System.out.println("异常导致操作回滚"); - connection.rollback(); - e.printStackTrace(); - } finally { - //释放资源 - JDBCUtil.release(connection, statement,null); - } - } -} diff --git a/src/test/java/cn/zzs/dbcp/InstanceKeyDataSourceTest.java b/src/test/java/cn/zzs/dbcp/InstanceKeyDataSourceTest.java new file mode 100644 index 0000000..bfd7c07 --- /dev/null +++ b/src/test/java/cn/zzs/dbcp/InstanceKeyDataSourceTest.java @@ -0,0 +1,22 @@ +/** + * Copyright © 2019 zzs. All rights reserved. + * + * @Title: InstanceKeyDataSourceTest.java + * @Prject: DBCP-demo + * @Package: cn.zzs.dbcp + * @Description: TODO + * @author: zzs + * @date: 2019年11月27日 上午8:33:40 + * @version: V 1.0.0 + */ +package cn.zzs.dbcp; + +/** + * @ClassName: InstanceKeyDataSourceTest + * @Description: 测试使用SharedPoolDataSource和PerUserPoolDataSource获取连接,并对比二者差异 + * @author: zzs + * @date: 2019年11月27日 上午8:33:40 + */ +public class InstanceKeyDataSourceTest { + +}