基于common-pool实现jdbc连接对象池化
基于common-pool实现jdbc连接对象池化:
主要解决方式通用性资源型实例池化管理,便于统一创建,资源监控及资源释放
主要分为三部分:
对象获取标识:DataSourceAccount
对象池工厂类:ConnectionPoolFactory
k-v对象池:GenericKeyedObjectPool
连接标识key:DataSourceAccount
/** * @ClassName DataSource.java * @author liangxiaohui * @version 1.0.0 * @Description */ public class DataSourceAccount { private String url; private String username; private String passsword; private String host; private String port; private String dbName; private String dbType; private final String gp_url="jdbc:postgresql://%s:%s/%s"; private final String mysql_url="jdbc:mysql://%s:%s/%s"; private final String hive_url="hive2://%s:%s/%s"; public String getUrl() { if("gp".equals(dbType)){ return String.format(gp_url,host,port,dbName); }else if("mysql".equals(dbType)){ return String.format(mysql_url,host,port,dbName); }else if("hive".equals(dbType)){ return String.format(hive_url,host,port,dbName); }else{ throw new IllegalArgumentException("参数异常"); } } public String getUsername() { return username; } public String getHost() { return host; } public void setHost(String host) { this.host = host; } public String getPort() { return port; } public void setPort(String port) { this.port = port; } public String getDbName() { return dbName; } public void setDbName(String dbName) { this.dbName = dbName; } public void setUsername(String username) { this.username = username; } public String getPasssword() { return passsword; } public void setPasssword(String passsword) { this.passsword = passsword; } @Override public int hashCode() { return (getUrl()+username+passsword).hashCode(); } @Override public boolean equals(Object obj) { if(this==obj){ return true; } if(null==obj){ return false; } DataSourceAccount objt=(DataSourceAccount)obj; if((getUrl()+username+passsword).equals(objt.getUrl()+objt.getUsername()+objt.getPasssword())){ return true; } return false; } public String getDbType() { return dbType; } public void setDbType(String dbType) { this.dbType = dbType; } }
对象池工厂类:ConnectionPoolFactory (内部类)(关于连接驱动:该示例没有通过class.forName显式手动加载到内存中(只通过maven引用依赖),但经测试依然可用,能够正常被注册)
网上资料:
JDBC 4.0的特性
得益于Mustang中的Java SE 服务提供商机制,Java开发人员再也不必用类似Class.forName() 的代码注册JDBC驱动来明确加载JDBC。
当调用DriverManager.getConnection()方法时,DriverManager类将 自动设置合适的驱动程序。该特性向后兼容,因此无需对现有的JDBC代码作任何改动。
DriverManager类源码中的原因注释(源代码62-65行):
* <P>Applications no longer need to explicitly load JDBC drivers using <code>Class.forName()</code>. Existing programs * which currently load JDBC drivers using <code>Class.forName()</code> will continue to work without * modification. *
工具类:JdbcConnectionPoimport org.apache.commons.pool.KeyedPoolableObjectFactory;
import org.apache.commons.pool.KeyedPoolableObjectFactory;
import org.apache.commons.pool.impl.GenericKeyedObjectPool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
* @author liangxiaohui
* @version 1.0.0
* @ClassName ConnectionPoolUtil.java
* @Description 连接池工具类(解决连接不释放问题)
*/
public class JdbcConnectionPoolUtil {
private static Logger logger = LoggerFactory.getLogger(JdbcConnectionPoolUtil.class);
private static GenericKeyedObjectPool<DataSourceAccount, Connection> pool;
//连接超时时间
private static final int connectionTimeOut = 60;
private static final int poolMaxActive = 60;
private static final int poolMaxIdle = 5;
private static final int poolMinIdle = 1;
private static final int poolMaxWait = -1;
private static final int poolTimeBetweenEvictionRunsMillis = 30000;
//初始化连接池
protected static GenericKeyedObjectPool<DataSourceAccount, Connection> getConnectionPool() {
if (pool == null) {
synchronized (JdbcConnectionPoolUtil.class) {
if (pool == null) {
GenericKeyedObjectPool.Config config = new GenericKeyedObjectPool.Config();
config.lifo = false;
config.maxActive = poolMaxActive;//最大激活数
config.maxIdle = poolMaxIdle;//最大空闲数
config.minIdle = poolMinIdle;//最小空闲数
config.maxWait = poolMaxWait;//最大等待时间
config.testOnBorrow = true;//获取对象是否检测有效性
config.testOnReturn = true;//归还对象是否检测有效性
config.testWhileIdle = true;//不需要移除的对象是否检测有效性
config.timeBetweenEvictionRunsMillis = poolTimeBetweenEvictionRunsMillis;//检测时间间隔
pool = new GenericKeyedObjectPool(new ConnectionPoolFactory(), config);
}
}
}
return pool;
}
//通过连接信息获取连接实例
public static Connection getConnectionByDataSource(DataSourceAccount dataSource) throws Exception {
return getConnectionPool().borrowObject(dataSource);
}
//归还连接实例
public static void returnConnectionToPool(DataSourceAccount dataSource, Connection connection) throws Exception {
getConnectionPool().returnObject(dataSource, connection);
getConnectionPool().clearOldest();
}
//扫描连接池中当前可用实例数量
public static void countConnectionNumForPool() {
logger.info("对象池当前激活实例总数量>>>>:" + getConnectionPool().getNumActive());
logger.info("对象池当前空闲实例总数量>>>>:" + getConnectionPool().getNumIdle());
}
//----------------------------------------------------------------------------------------------------
//--------------------------------------连接池初始化内部工厂类------------------------------------------
//----------------------------------------------------------------------------------------------------
/**
* @author liangxiaohui
* @version 1.0.0
* @ClassName ConnectionPoolFactory.java
* @Description 内部工厂类-对象池
*/
public static class ConnectionPoolFactory implements KeyedPoolableObjectFactory<DataSourceAccount, Connection> {
private static Logger logger = LoggerFactory.getLogger(ConnectionPoolFactory.class);
@Override
//创建新的实例到对象池
public Connection makeObject(DataSourceAccount key) throws Exception {
logger.info("创建新实例对象" + key.getUrl());
Connection conn = DriverManager.getConnection(key.getUrl(), key.getUsername(), key.getPasssword());
return conn;
}
@Override
//销毁实例(实例回收操作)
public void destroyObject(DataSourceAccount key, Connection obj) {
try{
logger.info("实例对象正在被销毁" + key.getUrl() + ":" + obj);
obj.close();
}catch(Exception e){
e.printStackTrace();
}
}
@Override
//验证连接是否可用(实例回收校验)
public boolean validateObject(DataSourceAccount key, Connection obj) {
try {
if (!obj.isValid(connectionTimeOut)) {
return false;
}
} catch (SQLException e) {
e.printStackTrace();
}
return true;
}
@Override
//申请连接实例调用(预处理操作)
public void activateObject(DataSourceAccount key, Connection obj) {
logger.info("获取实例对象..." + key + ":" +key.getUrl()+":"+ obj);
}
@Override
//归还实例时调用(后处理操作)
public void passivateObject(DataSourceAccount key, Connection obj) {
logger.info("归还实例对象..." + key + ":" +key.getUrl()+":" + obj);
}
}
}
功能测试类:
import org.junit.Test; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; /** * @author liangxiaohui * @version 1.0.0 * @ClassName JDBC ConnectionTest.java * @Description * @createTime 2021年11月02日 18:18:00 */ public class ConnectionTestJdbc { public static void test(){ Runnable runner1 = new Runnable() { @Override public void run() { DataSourceAccount db = new DataSourceAccount(); db.setHost("192.168.16.133"); db.setPort("5432"); db.setDbName("hdr"); db.setPasssword("gpadmin"); db.setUsername("gpadmin"); db.setDbType("gp"); try { Connection conn = JdbcConnectionPoolUtil.getConnectionByDataSource(db); System.out.println(Thread.currentThread().getName()+"conn:"+conn); Thread.sleep(10*1000); JdbcConnectionPoolUtil.countConnectionNumForPool(); JdbcConnectionPoolUtil.returnConnectionToPool(db,conn); } catch (Exception e) { e.printStackTrace(); } } }; Runnable runner2 = new Runnable() { @Override public void run() { DataSourceAccount db = new DataSourceAccount(); db.setHost("192.168.7.112"); db.setPort("3306"); db.setDbName("hdr-data-center-new"); db.setPasssword("hduap001"); db.setUsername("root"); db.setDbType("mysql"); try { Connection conn = JdbcConnectionPoolUtil.getConnectionByDataSource(db); System.out.println(Thread.currentThread().getName()+"conn:"+conn); PreparedStatement ps = conn.prepareStatement("show tables"); ResultSet result = ps.executeQuery(); while(result.next()){ System.out.println(result.getString(1)); } Thread.sleep(15*1000); JdbcConnectionPoolUtil.countConnectionNumForPool(); JdbcConnectionPoolUtil.returnConnectionToPool(db,conn); } catch (Exception e) { e.printStackTrace(); } } }; for (int i = 0; i < 10; i++) { Thread t1 = new Thread(runner1); Thread t2 = new Thread(runner2); t1.start(); t2.start(); } System.out.println("11111..."); } @Test public void testGpConnection(){ DataSourceAccount db = new DataSourceAccount(); db.setHost("192.168.7.112"); db.setPort("3306"); db.setDbName("hdr-data-center-new"); db.setPasssword("hduap001"); db.setUsername("root"); db.setDbType("mysql"); try { Connection conn = JdbcConnectionPoolUtil.getConnectionByDataSource(db); System.out.println(Thread.currentThread().getName()+"conn:"+conn); PreparedStatement ps = conn.prepareStatement("show tables"); ResultSet result = ps.executeQuery(); while(result.next()){ System.out.println(result.getString(1)); } Thread.sleep(15*1000); JdbcConnectionPoolUtil.countConnectionNumForPool(); JdbcConnectionPoolUtil.returnConnectionToPool(db,conn); } catch (Exception e) { e.printStackTrace(); } } //对象池化 public static void main(String[] args) { test(); JdbcConnectionPoolUtil.countConnectionNumForPool(); } }
测试结果:
21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 创建新实例对象jdbc:postgresql://192.168.16.133:5432/hdr 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 创建新实例对象jdbc:mysql://192.168.7.112:3306/hdr-data-center-new 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 创建新实例对象jdbc:mysql://192.168.7.112:3306/hdr-data-center-new 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil: 对象池当前激活实例总数量>>>>:0 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil: 对象池当前空闲实例总数量>>>>:0 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 创建新实例对象jdbc:postgresql://192.168.16.133:5432/hdr 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 创建新实例对象jdbc:mysql://192.168.7.112:3306/hdr-data-center-new 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 创建新实例对象jdbc:postgresql://192.168.16.133:5432/hdr 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 创建新实例对象jdbc:postgresql://192.168.16.133:5432/hdr 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 创建新实例对象jdbc:postgresql://192.168.16.133:5432/hdr 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 创建新实例对象jdbc:mysql://192.168.7.112:3306/hdr-data-center-new 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 创建新实例对象jdbc:mysql://192.168.7.112:3306/hdr-data-center-new 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 创建新实例对象jdbc:mysql://192.168.7.112:3306/hdr-data-center-new 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 创建新实例对象jdbc:postgresql://192.168.16.133:5432/hdr 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 创建新实例对象jdbc:postgresql://192.168.16.133:5432/hdr 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 创建新实例对象jdbc:mysql://192.168.7.112:3306/hdr-data-center-new 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 创建新实例对象jdbc:mysql://192.168.7.112:3306/hdr-data-center-new 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 创建新实例对象jdbc:postgresql://192.168.16.133:5432/hdr 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 创建新实例对象jdbc:postgresql://192.168.16.133:5432/hdr 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 创建新实例对象jdbc:postgresql://192.168.16.133:5432/hdr 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 创建新实例对象jdbc:mysql://192.168.7.112:3306/hdr-data-center-new 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 创建新实例对象jdbc:mysql://192.168.7.112:3306/hdr-data-center-new 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 获取实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@d1a7ed1:org.postgresql.jdbc.PgConnection@2903b2b Thread-8conn:org.postgresql.jdbc.PgConnection@2903b2b Thread-5conn:com.mysql.jdbc.JDBC4Connection@6a87c68e Thread-15conn:com.mysql.jdbc.JDBC4Connection@2aa47996 Thread-17conn:com.mysql.jdbc.JDBC4Connection@490e5ec5 Thread-19conn:com.mysql.jdbc.JDBC4Connection@57a1958c Thread-1conn:com.mysql.jdbc.JDBC4Connection@57f949ce Thread-7conn:com.mysql.jdbc.JDBC4Connection@216ed22a Thread-13conn:com.mysql.jdbc.JDBC4Connection@1da8148b Thread-9conn:com.mysql.jdbc.JDBC4Connection@53a69b9b Thread-3conn:com.mysql.jdbc.JDBC4Connection@421d47fd Thread-11conn:com.mysql.jdbc.JDBC4Connection@3b62b79b Thread-10conn:org.postgresql.jdbc.PgConnection@4a270ef2 Thread-14conn:org.postgresql.jdbc.PgConnection@a0808eb Thread-18conn:org.postgresql.jdbc.PgConnection@677c1662 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 获取实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@71742c2b:com.mysql.jdbc.JDBC4Connection@216ed22a 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 获取实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@71742c2b:com.mysql.jdbc.JDBC4Connection@6a87c68e 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 获取实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@71742c2b:com.mysql.jdbc.JDBC4Connection@53a69b9b 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 获取实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@71742c2b:com.mysql.jdbc.JDBC4Connection@1da8148b 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 获取实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@71742c2b:com.mysql.jdbc.JDBC4Connection@490e5ec5 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 获取实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@71742c2b:com.mysql.jdbc.JDBC4Connection@2aa47996 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 获取实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@71742c2b:com.mysql.jdbc.JDBC4Connection@3b62b79b 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 获取实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@71742c2b:com.mysql.jdbc.JDBC4Connection@57a1958c 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 获取实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@71742c2b:com.mysql.jdbc.JDBC4Connection@421d47fd 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 获取实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@71742c2b:com.mysql.jdbc.JDBC4Connection@57f949ce 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 获取实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@d1a7ed1:org.postgresql.jdbc.PgConnection@4a270ef2 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 获取实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@d1a7ed1:org.postgresql.jdbc.PgConnection@677c1662 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 获取实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@d1a7ed1:org.postgresql.jdbc.PgConnection@a0808eb 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 获取实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@d1a7ed1:org.postgresql.jdbc.PgConnection@628ec76f 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 获取实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@d1a7ed1:org.postgresql.jdbc.PgConnection@2defdf15 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 获取实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@d1a7ed1:org.postgresql.jdbc.PgConnection@4c0e7289 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 获取实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@d1a7ed1:org.postgresql.jdbc.PgConnection@2a8c0db5 Thread-0conn:org.postgresql.jdbc.PgConnection@628ec76f Thread-16conn:org.postgresql.jdbc.PgConnection@2defdf15 Thread-2conn:org.postgresql.jdbc.PgConnection@4c0e7289 Thread-4conn:org.postgresql.jdbc.PgConnection@2a8c0db5 Thread-6conn:org.postgresql.jdbc.PgConnection@7098d28f Thread-12conn:org.postgresql.jdbc.PgConnection@75300731 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 获取实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@d1a7ed1:org.postgresql.jdbc.PgConnection@7098d28f 21/11/05 17:38:34 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 获取实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@d1a7ed1:org.postgresql.jdbc.PgConnection@75300731 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil: 对象池当前激活实例总数量>>>>:20 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil: 对象池当前空闲实例总数量>>>>:0 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 归还实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@d1a7ed1:org.postgresql.jdbc.PgConnection@2903b2b 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 实例对象正在被销毁jdbc:postgresql://192.168.16.133:5432/hdr:org.postgresql.jdbc.PgConnection@2903b2b 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil: 对象池当前激活实例总数量>>>>:19 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil: 对象池当前空闲实例总数量>>>>:0 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil: 对象池当前激活实例总数量>>>>:19 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil: 对象池当前激活实例总数量>>>>:19 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil: 对象池当前空闲实例总数量>>>>:0 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil: 对象池当前空闲实例总数量>>>>:0 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 归还实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@d1a7ed1:org.postgresql.jdbc.PgConnection@a0808eb 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 实例对象正在被销毁jdbc:postgresql://192.168.16.133:5432/hdr:org.postgresql.jdbc.PgConnection@a0808eb 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 归还实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@d1a7ed1:org.postgresql.jdbc.PgConnection@677c1662 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 归还实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@d1a7ed1:org.postgresql.jdbc.PgConnection@4a270ef2 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 实例对象正在被销毁jdbc:postgresql://192.168.16.133:5432/hdr:org.postgresql.jdbc.PgConnection@677c1662 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 实例对象正在被销毁jdbc:postgresql://192.168.16.133:5432/hdr:org.postgresql.jdbc.PgConnection@4a270ef2 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil: 对象池当前激活实例总数量>>>>:16 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil: 对象池当前空闲实例总数量>>>>:0 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil: 对象池当前激活实例总数量>>>>:16 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil: 对象池当前激活实例总数量>>>>:16 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil: 对象池当前空闲实例总数量>>>>:0 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil: 对象池当前空闲实例总数量>>>>:0 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 归还实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@d1a7ed1:org.postgresql.jdbc.PgConnection@4c0e7289 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 归还实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@d1a7ed1:org.postgresql.jdbc.PgConnection@2defdf15 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 实例对象正在被销毁jdbc:postgresql://192.168.16.133:5432/hdr:org.postgresql.jdbc.PgConnection@4c0e7289 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 实例对象正在被销毁jdbc:postgresql://192.168.16.133:5432/hdr:org.postgresql.jdbc.PgConnection@2defdf15 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 归还实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@d1a7ed1:org.postgresql.jdbc.PgConnection@628ec76f 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 实例对象正在被销毁jdbc:postgresql://192.168.16.133:5432/hdr:org.postgresql.jdbc.PgConnection@628ec76f 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil: 对象池当前激活实例总数量>>>>:13 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil: 对象池当前空闲实例总数量>>>>:0 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil: 对象池当前激活实例总数量>>>>:13 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil: 对象池当前激活实例总数量>>>>:13 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil: 对象池当前空闲实例总数量>>>>:0 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil: 对象池当前空闲实例总数量>>>>:0 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 归还实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@d1a7ed1:org.postgresql.jdbc.PgConnection@75300731 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 归还实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@d1a7ed1:org.postgresql.jdbc.PgConnection@7098d28f 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 实例对象正在被销毁jdbc:postgresql://192.168.16.133:5432/hdr:org.postgresql.jdbc.PgConnection@75300731 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 实例对象正在被销毁jdbc:postgresql://192.168.16.133:5432/hdr:org.postgresql.jdbc.PgConnection@7098d28f 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 归还实例对象...com.goodwill.hdr.dwd.util.connection.jdbc.DataSourceAccount@d1a7ed1:org.postgresql.jdbc.PgConnection@2a8c0db5 21/11/05 17:38:44 INFO jdbc.JdbcConnectionPoolUtil$ConnectionPoolFactory: 实例对象正在被销毁jdbc:postgresql://192.168.16.133:5432/hdr:org.postgresql.jdbc.PgConnection@2a8c0db5
本文来自博客园,作者:夜半风起,转载请注明原文链接:https://www.cnblogs.com/yebanfengqi/p/15514459.html