|
|
|
@ -15,6 +15,16 @@
|
|
|
|
|
*/ |
|
|
|
|
package com.fr.third.alibaba.druid.pool; |
|
|
|
|
|
|
|
|
|
import com.fr.third.alibaba.druid.DbType; |
|
|
|
|
import com.fr.third.alibaba.druid.pool.DruidAbstractDataSource.PhysicalConnectionInfo; |
|
|
|
|
import com.fr.third.alibaba.druid.proxy.jdbc.WrapperProxy; |
|
|
|
|
import com.fr.third.alibaba.druid.support.logging.Log; |
|
|
|
|
import com.fr.third.alibaba.druid.support.logging.LogFactory; |
|
|
|
|
import com.fr.third.alibaba.druid.util.JdbcUtils; |
|
|
|
|
import com.fr.third.alibaba.druid.util.Utils; |
|
|
|
|
|
|
|
|
|
import javax.sql.ConnectionEventListener; |
|
|
|
|
import javax.sql.StatementEventListener; |
|
|
|
|
import java.sql.Connection; |
|
|
|
|
import java.sql.SQLException; |
|
|
|
|
import java.sql.SQLFeatureNotSupportedException; |
|
|
|
@ -26,18 +36,6 @@ import java.util.Map;
|
|
|
|
|
import java.util.concurrent.CopyOnWriteArrayList; |
|
|
|
|
import java.util.concurrent.locks.ReentrantLock; |
|
|
|
|
|
|
|
|
|
import javax.sql.ConnectionEventListener; |
|
|
|
|
import javax.sql.StatementEventListener; |
|
|
|
|
|
|
|
|
|
import com.fr.third.alibaba.druid.DbType; |
|
|
|
|
import com.fr.third.alibaba.druid.pool.DruidAbstractDataSource.PhysicalConnectionInfo; |
|
|
|
|
import com.fr.third.alibaba.druid.proxy.jdbc.WrapperProxy; |
|
|
|
|
import com.fr.third.alibaba.druid.support.logging.Log; |
|
|
|
|
import com.fr.third.alibaba.druid.support.logging.LogFactory; |
|
|
|
|
import com.fr.third.alibaba.druid.util.JdbcConstants; |
|
|
|
|
import com.fr.third.alibaba.druid.util.JdbcUtils; |
|
|
|
|
import com.fr.third.alibaba.druid.util.Utils; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @author wenshao [szujobs@hotmail.com] |
|
|
|
|
*/ |
|
|
|
@ -77,7 +75,7 @@ public final class DruidConnectionHolder {
|
|
|
|
|
protected String initSchema; |
|
|
|
|
|
|
|
|
|
public DruidConnectionHolder(DruidAbstractDataSource dataSource, PhysicalConnectionInfo pyConnectInfo) |
|
|
|
|
throws SQLException{ |
|
|
|
|
throws SQLException { |
|
|
|
|
this(dataSource, |
|
|
|
|
pyConnectInfo.getPhysicalConnection(), |
|
|
|
|
pyConnectInfo.getConnectNanoSpan(), |
|
|
|
@ -86,13 +84,13 @@ public final class DruidConnectionHolder {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public DruidConnectionHolder(DruidAbstractDataSource dataSource, Connection conn, long connectNanoSpan) |
|
|
|
|
throws SQLException{ |
|
|
|
|
throws SQLException { |
|
|
|
|
this(dataSource, conn, connectNanoSpan, null, null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public DruidConnectionHolder(DruidAbstractDataSource dataSource, Connection conn, long connectNanoSpan, |
|
|
|
|
Map<String, Object> variables, Map<String, Object> globleVariables) |
|
|
|
|
throws SQLException{ |
|
|
|
|
throws SQLException { |
|
|
|
|
this.dataSource = dataSource; |
|
|
|
|
this.conn = conn; |
|
|
|
|
this.createNanoSpan = connectNanoSpan; |
|
|
|
@ -124,10 +122,7 @@ public final class DruidConnectionHolder {
|
|
|
|
|
if (initUnderlyHoldability) { |
|
|
|
|
try { |
|
|
|
|
this.underlyingHoldability = conn.getHoldability(); |
|
|
|
|
} catch (UnsupportedOperationException e) { |
|
|
|
|
holdabilityUnsupported = true; |
|
|
|
|
LOG.warn("getHoldability unsupported", e); |
|
|
|
|
} catch (SQLFeatureNotSupportedException e) { |
|
|
|
|
} catch (UnsupportedOperationException | AbstractMethodError | SQLFeatureNotSupportedException e) { |
|
|
|
|
holdabilityUnsupported = true; |
|
|
|
|
LOG.warn("getHoldability unsupported", e); |
|
|
|
|
} catch (SQLException e) { |
|
|
|
@ -136,6 +131,8 @@ public final class DruidConnectionHolder {
|
|
|
|
|
holdabilityUnsupported = true; |
|
|
|
|
} |
|
|
|
|
LOG.warn("getHoldability error", e); |
|
|
|
|
} catch (Throwable e) { |
|
|
|
|
LOG.warn("getHoldability error", e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|