diff --git a/pom.xml b/pom.xml
index b7e4b307d5..f534b99eea 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,538 +1,538 @@
-
- 4.0.0
-
- com.alibaba
- druid
- 0.2.21-SNAPSHOT
-
- jar
- druid
- An JDBC datasource implementation.
- https://github.com/AlibabaTech/druid
- 2012
-
-
- 3.1.1.RELEASE
- 4.11
-
- true
- true
-
- UTF-8
- 1.6
-
-
-
-
- local-file
- file://${basedir}/lib/
- default
-
-
-
-
-
- opensesame
- dav:http://code.alibabatech.com/mvn/releases/
-
-
- opensesame
- dav:http://code.alibabatech.com/mvn/snapshots/
-
-
-
-
-
- wenshao
- wenshao
- szujobs@hotmail.com
-
-
-
-
- https://wenshao@github.com/AlibabaTech/druid.git
- scm:git:https://wenshao@github.com/AlibabaTech/druid.git
-
-
-
- Alibaba Group
- http://code.alibabatech.com/
-
-
-
-
- Apache 2
- http://www.apache.org/licenses/LICENSE-2.0.txt
- repo
- A business-friendly OSS license
-
-
-
-
- Jira
- http://code.alibabatech.com/jira/browse/DRUID
-
-
-
-
- org.apache.maven.wagon
- wagon-webdav
- 1.0-beta-2
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.0
-
- UTF-8
- 1.6
- 1.6
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- 2.12.4
-
-
- **/bvt/**/*.java
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.2.1
-
-
- attach-sources
-
- jar-no-fork
-
-
-
-
- true
-
-
-
-
- maven-javadoc-plugin
- 2.9
-
-
- attach-javadoc
-
- jar
-
-
-
-
- ${javadoc.skip}
- public
- UTF-8
- UTF-8
- UTF-8
-
- http://docs.oracle.com/javase/6/docs/api
-
-
-
-
-
- maven-gpg-plugin
- 1.4
-
- ${gpg.skip}
-
-
-
- sign-artifacts
- verify
-
- sign
-
-
-
-
-
-
-
-
- false
- com.mycila.maven-license-plugin
- maven-license-plugin
- 1.10.b1
-
- ${basedir}/doc/license.txt
- true
- true
- true
-
-
-
-
- SLASHSTAR_STYLE
-
-
- src/main/java/**/*.java
-
- UTF-8
-
-
-
- check-headers
- verify
-
- check
-
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
- 2.4
-
-
-
- true
-
-
- ${buildNumber}
-
-
-
-
-
- org.codehaus.mojo
- buildnumber-maven-plugin
- 1.1
-
-
- validate
-
- create
-
-
-
-
- {0,date,yyyy-MM-dd HH:mm:ss}
-
- - timestamp
-
- false
- true
-
-
-
-
-
-
-
- mc-release
- Local Maven repository of releases
- http://mc-repo.googlecode.com/svn/maven2/releases
-
- true
-
-
- false
-
-
-
-
-
-
- default-profile
-
- true
-
- ${java.home}/../lib/jconsole.jar
-
-
-
- ${java.home}/../lib/tools.jar
- ${java.home}/../lib/jconsole.jar
-
-
-
-
- com.alibaba
- jconsole
- 1.6.0
- system
- ${jconsolejar}
- true
-
-
- com.alibaba
- tools
- 1.6.0
- system
- ${toolsjar}
- true
-
-
-
-
- mac-profile
-
- false
-
- ${java.home}/../Classes/jconsole.jar
-
-
-
-
- com.alibaba
- jconsole
- 1.6.0
- system
- ${java.home}/../Classes/jconsole.jar
-
-
-
-
-
-
-
- javax.transaction
- jta
- 1.1
- provided
- true
-
-
-
- javax.servlet
- servlet-api
- 2.5
- provided
- true
-
-
- commons-logging
- commons-logging
- 1.1.1
- provided
- true
-
-
-
- org.springframework
- spring-core
- ${spring.version}
- provided
- true
-
-
- org.springframework
- spring-beans
- ${spring.version}
- provided
- true
-
-
- org.springframework
- spring-orm
- ${spring.version}
- provided
- true
-
-
- org.springframework
- spring-test
- ${spring.version}
- test
-
-
-
- org.springframework
- spring-ibatis
- 2.0.8
- provided
- true
-
-
- org.mybatis
- mybatis
- 3.1.1
- provided
- true
-
-
- org.mybatis
- mybatis-spring
- 1.1.1
- provided
- true
-
-
-
- log4j
- log4j
- 1.2.16
- provided
-
-
- org.slf4j
- slf4j-api
- 1.6.1
- provided
-
-
- org.slf4j
- slf4j-log4j12
- 1.6.1
- provided
-
-
-
- mysql
- mysql-connector-java
- 5.1.24
- provided
-
-
- net.sourceforge.jtds
- jtds
- 1.3.0
- provided
-
-
-
- postgresql
- postgresql
- 9.1-901-1.jdbc4
- provided
-
-
-
-
- com.oracle
- ojdbc14
- 10.2.0.2
- provided
-
-
-
- com.microsoft.sqlserver
- sqljdbc4
- 4.0.2206.100
- test
-
-
-
- org.nutz
- nutz
- 1.b.40
- test
-
-
-
- junit
- junit
- ${junit.version}
- test
-
-
- org.apache.derby
- derby
- 10.9.1.0
- test
-
-
-
- commons-dbcp
- commons-dbcp
- 1.4
- test
-
-
- com.jolbox
- bonecp
- 0.7.1.RELEASE
- test
-
-
- com.jolbox
- bonecp-spring
- 0.7.1.RELEASE
- test
-
-
- proxool
- proxool
- 0.9.1
- test
-
-
- proxool
- proxool-cglib
- 0.9.1
- test
-
-
-
- c3p0
- c3p0
- 0.9.1.2
- test
-
-
-
- org.apache.tomcat
- tomcat-jdbc
- 7.0.34
- test
-
-
-
- org.apache.ibatis
- ibatis-sqlmap
- 2.3.4.726
- provided
-
-
-
- com.h2database
- h2
- 1.3.170
- provided
-
-
-
- org.hibernate
- hibernate-core
- 4.1.9.Final
- provided
-
-
-
- commons-dbutils
- commons-dbutils
- 1.5
- test
-
-
-
- org.nutz
- nutz
- 1.b.47
- test
-
-
- com.taobao.tbdatasource
- tbdatasource
- 2.0.2
- test
-
-
-
+
+ 4.0.0
+
+ com.alibaba
+ druid
+ 0.2.21
+
+ jar
+ druid
+ An JDBC datasource implementation.
+ https://github.com/AlibabaTech/druid
+ 2012
+
+
+ 3.1.1.RELEASE
+ 4.11
+
+ true
+ true
+
+ UTF-8
+ 1.6
+
+
+
+
+ local-file
+ file://${basedir}/lib/
+ default
+
+
+
+
+
+ opensesame
+ dav:http://code.alibabatech.com/mvn/releases/
+
+
+ opensesame
+ dav:http://code.alibabatech.com/mvn/snapshots/
+
+
+
+
+
+ wenshao
+ wenshao
+ szujobs@hotmail.com
+
+
+
+
+ https://wenshao@github.com/AlibabaTech/druid.git
+ scm:git:https://wenshao@github.com/AlibabaTech/druid.git
+
+
+
+ Alibaba Group
+ http://code.alibabatech.com/
+
+
+
+
+ Apache 2
+ http://www.apache.org/licenses/LICENSE-2.0.txt
+ repo
+ A business-friendly OSS license
+
+
+
+
+ Jira
+ http://code.alibabatech.com/jira/browse/DRUID
+
+
+
+
+ org.apache.maven.wagon
+ wagon-webdav
+ 1.0-beta-2
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.0
+
+ UTF-8
+ 1.6
+ 1.6
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.12.4
+
+
+ **/bvt/**/*.java
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 2.2.1
+
+
+ attach-sources
+
+ jar-no-fork
+
+
+
+
+ true
+
+
+
+
+ maven-javadoc-plugin
+ 2.9
+
+
+ attach-javadoc
+
+ jar
+
+
+
+
+ ${javadoc.skip}
+ public
+ UTF-8
+ UTF-8
+ UTF-8
+
+ http://docs.oracle.com/javase/6/docs/api
+
+
+
+
+
+ maven-gpg-plugin
+ 1.4
+
+ ${gpg.skip}
+
+
+
+ sign-artifacts
+ verify
+
+ sign
+
+
+
+
+
+
+
+
+ false
+ com.mycila.maven-license-plugin
+ maven-license-plugin
+ 1.10.b1
+
+ ${basedir}/doc/license.txt
+ true
+ true
+ true
+
+
+
+
+ SLASHSTAR_STYLE
+
+
+ src/main/java/**/*.java
+
+ UTF-8
+
+
+
+ check-headers
+ verify
+
+ check
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.4
+
+
+
+ true
+
+
+ ${buildNumber}
+
+
+
+
+
+ org.codehaus.mojo
+ buildnumber-maven-plugin
+ 1.1
+
+
+ validate
+
+ create
+
+
+
+
+ {0,date,yyyy-MM-dd HH:mm:ss}
+
+ - timestamp
+
+ false
+ true
+
+
+
+
+
+
+
+ mc-release
+ Local Maven repository of releases
+ http://mc-repo.googlecode.com/svn/maven2/releases
+
+ true
+
+
+ false
+
+
+
+
+
+
+ default-profile
+
+ true
+
+ ${java.home}/../lib/jconsole.jar
+
+
+
+ ${java.home}/../lib/tools.jar
+ ${java.home}/../lib/jconsole.jar
+
+
+
+
+ com.alibaba
+ jconsole
+ 1.6.0
+ system
+ ${jconsolejar}
+ true
+
+
+ com.alibaba
+ tools
+ 1.6.0
+ system
+ ${toolsjar}
+ true
+
+
+
+
+ mac-profile
+
+ false
+
+ ${java.home}/../Classes/jconsole.jar
+
+
+
+
+ com.alibaba
+ jconsole
+ 1.6.0
+ system
+ ${java.home}/../Classes/jconsole.jar
+
+
+
+
+
+
+
+ javax.transaction
+ jta
+ 1.1
+ provided
+ true
+
+
+
+ javax.servlet
+ servlet-api
+ 2.5
+ provided
+ true
+
+
+ commons-logging
+ commons-logging
+ 1.1.1
+ provided
+ true
+
+
+
+ org.springframework
+ spring-core
+ ${spring.version}
+ provided
+ true
+
+
+ org.springframework
+ spring-beans
+ ${spring.version}
+ provided
+ true
+
+
+ org.springframework
+ spring-orm
+ ${spring.version}
+ provided
+ true
+
+
+ org.springframework
+ spring-test
+ ${spring.version}
+ test
+
+
+
+ org.springframework
+ spring-ibatis
+ 2.0.8
+ provided
+ true
+
+
+ org.mybatis
+ mybatis
+ 3.1.1
+ provided
+ true
+
+
+ org.mybatis
+ mybatis-spring
+ 1.1.1
+ provided
+ true
+
+
+
+ log4j
+ log4j
+ 1.2.16
+ provided
+
+
+ org.slf4j
+ slf4j-api
+ 1.6.1
+ provided
+
+
+ org.slf4j
+ slf4j-log4j12
+ 1.6.1
+ provided
+
+
+
+ mysql
+ mysql-connector-java
+ 5.1.24
+ provided
+
+
+ net.sourceforge.jtds
+ jtds
+ 1.3.0
+ provided
+
+
+
+ postgresql
+ postgresql
+ 9.1-901-1.jdbc4
+ provided
+
+
+
+
+ com.oracle
+ ojdbc14
+ 10.2.0.2
+ provided
+
+
+
+ com.microsoft.sqlserver
+ sqljdbc4
+ 4.0.2206.100
+ test
+
+
+
+ org.nutz
+ nutz
+ 1.b.40
+ test
+
+
+
+ junit
+ junit
+ ${junit.version}
+ test
+
+
+ org.apache.derby
+ derby
+ 10.9.1.0
+ test
+
+
+
+ commons-dbcp
+ commons-dbcp
+ 1.4
+ test
+
+
+ com.jolbox
+ bonecp
+ 0.7.1.RELEASE
+ test
+
+
+ com.jolbox
+ bonecp-spring
+ 0.7.1.RELEASE
+ test
+
+
+ proxool
+ proxool
+ 0.9.1
+ test
+
+
+ proxool
+ proxool-cglib
+ 0.9.1
+ test
+
+
+
+ c3p0
+ c3p0
+ 0.9.1.2
+ test
+
+
+
+ org.apache.tomcat
+ tomcat-jdbc
+ 7.0.34
+ test
+
+
+
+ org.apache.ibatis
+ ibatis-sqlmap
+ 2.3.4.726
+ provided
+
+
+
+ com.h2database
+ h2
+ 1.3.170
+ provided
+
+
+
+ org.hibernate
+ hibernate-core
+ 4.1.9.Final
+ provided
+
+
+
+ commons-dbutils
+ commons-dbutils
+ 1.5
+ test
+
+
+
+ org.nutz
+ nutz
+ 1.b.47
+ test
+
+
+ com.taobao.tbdatasource
+ tbdatasource
+ 2.0.2
+ test
+
+
+
diff --git a/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java b/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java
index 6adb7d53bb..6155f1aebe 100644
--- a/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java
+++ b/src/main/java/com/alibaba/druid/pool/DruidAbstractDataSource.java
@@ -1,1621 +1,1645 @@
-/*
- * Copyright 1999-2011 Alibaba Group Holding Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.alibaba.druid.pool;
-
-import java.io.PrintWriter;
-import java.io.Serializable;
-import java.sql.Connection;
-import java.sql.Driver;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.IdentityHashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.ReentrantLock;
-import java.util.logging.Logger;
-
-import javax.management.JMException;
-import javax.management.ObjectName;
-import javax.management.openmbean.CompositeDataSupport;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.sql.DataSource;
-
-import com.alibaba.druid.filter.Filter;
-import com.alibaba.druid.filter.FilterChainImpl;
-import com.alibaba.druid.filter.FilterManager;
-import com.alibaba.druid.pool.vendor.NullExceptionSorter;
-import com.alibaba.druid.proxy.jdbc.DataSourceProxy;
-import com.alibaba.druid.proxy.jdbc.TransactionInfo;
-import com.alibaba.druid.stat.JdbcDataSourceStat;
-import com.alibaba.druid.stat.JdbcSqlStat;
-import com.alibaba.druid.stat.JdbcStatManager;
-import com.alibaba.druid.support.logging.Log;
-import com.alibaba.druid.support.logging.LogFactory;
-import com.alibaba.druid.util.DruidPasswordCallback;
-import com.alibaba.druid.util.Histogram;
-import com.alibaba.druid.util.IOUtils;
-import com.alibaba.druid.util.JdbcUtils;
-import com.alibaba.druid.util.StringUtils;
-
-/**
- * @author wenshao
- * @author ljw
- */
-public abstract class DruidAbstractDataSource extends WrapperAdapter implements DruidAbstractDataSourceMBean, DataSource, DataSourceProxy, Serializable {
-
- private final static Log LOG = LogFactory.getLog(DruidAbstractDataSource.class);
-
- private static final long serialVersionUID = 1L;
-
- public final static int DEFAULT_INITIAL_SIZE = 0;
- public final static int DEFAULT_MAX_ACTIVE_SIZE = 8;
- public final static int DEFAULT_MAX_IDLE = 8;
- public final static int DEFAULT_MIN_IDLE = 0;
- public final static int DEFAULT_MAX_WAIT = -1;
- public final static String DEFAULT_VALIDATION_QUERY = null; //
- public final static boolean DEFAULT_TEST_ON_BORROW = false;
- public final static boolean DEFAULT_TEST_ON_RETURN = false;
- public final static boolean DEFAULT_WHILE_IDLE = true;
- public static final long DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS = -1L;
- public static final long DEFAULT_TIME_BETWEEN_CONNECT_ERROR_MILLIS = 30 * 1000;
- public static final int DEFAULT_NUM_TESTS_PER_EVICTION_RUN = 3;
-
- /**
- * The default value for {@link #getMinEvictableIdleTimeMillis}.
- *
- * @see #getMinEvictableIdleTimeMillis
- * @see #setMinEvictableIdleTimeMillis
- */
- public static final long DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS = 1000L * 60L * 30L;
-
- protected volatile boolean defaultAutoCommit = true;
- protected volatile Boolean defaultReadOnly;
- protected volatile Integer defaultTransactionIsolation;
- protected volatile String defaultCatalog = null;
-
- protected String name;
-
- protected volatile String username;
- protected volatile String password;
- protected volatile String jdbcUrl;
- protected volatile String driverClass;
- protected volatile ClassLoader driverClassLoader;
- protected volatile Properties connectProperties = new Properties();
-
- protected volatile PasswordCallback passwordCallback;
- protected volatile NameCallback userCallback;
-
- protected volatile int initialSize = DEFAULT_INITIAL_SIZE;
- protected volatile int maxActive = DEFAULT_MAX_ACTIVE_SIZE;
- protected volatile int minIdle = DEFAULT_MIN_IDLE;
- protected volatile int maxIdle = DEFAULT_MAX_IDLE;
- protected volatile long maxWait = DEFAULT_MAX_WAIT;
-
- protected volatile String validationQuery = DEFAULT_VALIDATION_QUERY;
- protected volatile int validationQueryTimeout = -1;
- private volatile boolean testOnBorrow = DEFAULT_TEST_ON_BORROW;
- private volatile boolean testOnReturn = DEFAULT_TEST_ON_RETURN;
- private volatile boolean testWhileIdle = DEFAULT_WHILE_IDLE;
- protected volatile boolean poolPreparedStatements = false;
- protected volatile boolean sharePreparedStatements = false;
- protected volatile int maxPoolPreparedStatementPerConnectionSize = 10;
-
- protected volatile boolean inited = false;
-
- protected PrintWriter logWriter = new PrintWriter(
- System.out);
-
- protected List filters = new CopyOnWriteArrayList();
- protected volatile ExceptionSorter exceptionSorter = null;
-
- protected Driver driver;
-
- protected volatile int queryTimeout;
- protected volatile int transactionQueryTimeout;
-
- protected AtomicLong createErrorCount = new AtomicLong();
-
- protected long createTimespan;
-
- protected volatile int maxWaitThreadCount = -1;
-
- protected volatile boolean accessToUnderlyingConnectionAllowed = true;
-
- protected volatile long timeBetweenEvictionRunsMillis = DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS;
-
- protected volatile int numTestsPerEvictionRun = DEFAULT_NUM_TESTS_PER_EVICTION_RUN;
-
- protected volatile long minEvictableIdleTimeMillis = DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS;
-
- protected volatile boolean removeAbandoned;
-
- protected volatile long removeAbandonedTimeoutMillis = 300 * 1000;
-
- protected volatile boolean logAbandoned;
-
- protected volatile int maxOpenPreparedStatements = -1;
-
- protected volatile List connectionInitSqls;
-
- protected volatile String dbType;
-
- protected volatile long timeBetweenConnectErrorMillis = DEFAULT_TIME_BETWEEN_CONNECT_ERROR_MILLIS;
-
- protected volatile ValidConnectionChecker validConnectionChecker = null;
-
- protected final AtomicLong errorCount = new AtomicLong();
- protected final AtomicLong dupCloseCount = new AtomicLong();
-
- protected final Map activeConnections = new IdentityHashMap();
- protected final static Object PRESENT = new Object();
-
- protected long id;
-
- protected final Date createdTime = new Date();
- protected Date initedTime;
-
- protected int connectionErrorRetryAttempts = 30;
-
- protected boolean breakAfterAcquireFailure = false;
-
- protected long transactionThresholdMillis = 0L;
-
- protected final AtomicLong commitCount = new AtomicLong();
- protected final AtomicLong startTransactionCount = new AtomicLong();
- protected final AtomicLong rollbackCount = new AtomicLong();
- protected final AtomicLong cachedPreparedStatementHitCount = new AtomicLong();
- protected final AtomicLong preparedStatementCount = new AtomicLong();
- protected final AtomicLong closedPreparedStatementCount = new AtomicLong();
- protected final AtomicLong cachedPreparedStatementCount = new AtomicLong();
- protected final AtomicLong cachedPreparedStatementDeleteCount = new AtomicLong();
- protected final AtomicLong cachedPreparedStatementMissCount = new AtomicLong();
-
- protected final Histogram transactionHistogram = new Histogram(
- 10,
- 100,
- 1000,
- 10 * 1000,
- 100 * 1000);
-
- private boolean dupCloseLogEnable = false;
-
- private ObjectName objectName;
-
- protected final AtomicLong executeCount = new AtomicLong();
-
- protected volatile Throwable createError;
- protected volatile Throwable lastError;
- protected volatile long lastErrorTimeMillis;
- protected volatile Throwable lastCreateError;
- protected volatile long lastCreateErrorTimeMillis;
-
- protected boolean isOracle = false;
-
- protected boolean useOracleImplicitCache = true;
-
- protected ReentrantLock lock;
- protected Condition notEmpty;
- protected Condition empty;
-
- protected AtomicLong createCount = new AtomicLong();
- protected AtomicLong destroyCount = new AtomicLong();
-
- private Boolean useUnfairLock = null;
-
- private boolean useLocalSessionState = true;
-
- protected long timeBetweenLogStatsMillis;
- protected DruidDataSourceStatLogger statLogger = new DruidDataSourceStatLoggerImpl();
-
- public DruidAbstractDataSource(boolean lockFair){
- lock = new ReentrantLock(lockFair);
-
- notEmpty = lock.newCondition();
- empty = lock.newCondition();
- }
-
- public boolean isUseLocalSessionState() {
- return useLocalSessionState;
- }
-
- public void setUseLocalSessionState(boolean useLocalSessionState) {
- this.useLocalSessionState = useLocalSessionState;
- }
-
- public DruidDataSourceStatLogger getStatLogger() {
- return statLogger;
- }
-
- public void setStatLoggerClassName(String className) {
- Class> clazz;
- try {
- clazz = Class.forName(className);
- DruidDataSourceStatLogger statLogger = (DruidDataSourceStatLogger) clazz.newInstance();
- this.setStatLogger(statLogger);
- } catch (Exception e) {
- throw new IllegalArgumentException(className, e);
- }
- }
-
- public void setStatLogger(DruidDataSourceStatLogger statLogger) {
- this.statLogger = statLogger;
- }
-
- public long getTimeBetweenLogStatsMillis() {
- return timeBetweenLogStatsMillis;
- }
-
- public void setTimeBetweenLogStatsMillis(long timeBetweenLogStatsMillis) {
- this.timeBetweenLogStatsMillis = timeBetweenLogStatsMillis;
- }
-
- public boolean isOracle() {
- return isOracle;
- }
-
- public void setOracle(boolean isOracle) {
- if (inited) {
- throw new IllegalStateException();
- }
- this.isOracle = isOracle;
- }
-
- public boolean isUseUnfairLock() {
- return lock.isFair();
- }
-
- public void setUseUnfairLock(boolean useUnfairLock) {
- if (lock.isFair() == !useUnfairLock) {
- return;
- }
-
- if (!this.inited) {
- final ReentrantLock lock = this.lock;
- lock.lock();
- try {
- if (!this.inited) {
- this.lock = new ReentrantLock(!useUnfairLock);
- this.notEmpty = this.lock.newCondition();
- this.empty = this.lock.newCondition();
-
- this.useUnfairLock = useUnfairLock;
- }
- } finally {
- lock.unlock();
- }
- }
- }
-
- public boolean isUseOracleImplicitCache() {
- return useOracleImplicitCache;
- }
-
- public void setUseOracleImplicitCache(boolean useOracleImplicitCache) {
- if (this.useOracleImplicitCache != useOracleImplicitCache) {
- this.useOracleImplicitCache = useOracleImplicitCache;
- boolean isOracleDriver10 = isOracle() && this.driver != null && this.driver.getMajorVersion() == 10;
-
- if (isOracleDriver10 && useOracleImplicitCache) {
- this.getConnectProperties().setProperty("oracle.jdbc.FreeMemoryOnEnterImplicitCache", "true");
- } else {
- this.getConnectProperties().remove("oracle.jdbc.FreeMemoryOnEnterImplicitCache");
- }
- }
- }
-
- public Throwable getLastCreateError() {
- return lastCreateError;
- }
-
- public Throwable getLastError() {
- return this.lastError;
- }
-
- public long getLastErrorTimeMillis() {
- return lastErrorTimeMillis;
- }
-
- public Date getLastErrorTime() {
- if (lastErrorTimeMillis <= 0) {
- return null;
- }
-
- return new Date(lastErrorTimeMillis);
- }
-
- public long getLastCreateErrorTimeMillis() {
- return lastCreateErrorTimeMillis;
- }
-
- public Date getLastCreateErrorTime() {
- if (lastCreateErrorTimeMillis <= 0) {
- return null;
- }
-
- return new Date(lastCreateErrorTimeMillis);
- }
-
- public int getTransactionQueryTimeout() {
- if (transactionQueryTimeout <= 0) {
- return queryTimeout;
- }
-
- return transactionQueryTimeout;
- }
-
- public void setTransactionQueryTimeout(int transactionQueryTimeout) {
- this.transactionQueryTimeout = transactionQueryTimeout;
- }
-
- public long getExecuteCount() {
- return executeCount.get();
- }
-
- public void incrementExecuteCount() {
- this.executeCount.incrementAndGet();
- }
-
- public boolean isDupCloseLogEnable() {
- return dupCloseLogEnable;
- }
-
- public void setDupCloseLogEnable(boolean dupCloseLogEnable) {
- this.dupCloseLogEnable = dupCloseLogEnable;
- }
-
- public ObjectName getObjectName() {
- return objectName;
- }
-
- public void setObjectName(ObjectName objectName) {
- this.objectName = objectName;
- }
-
- public Histogram getTransactionHistogram() {
- return transactionHistogram;
- }
-
- public void incrementCachedPreparedStatementCount() {
- cachedPreparedStatementCount.incrementAndGet();
- }
-
- public void decrementCachedPreparedStatementCount() {
- cachedPreparedStatementCount.decrementAndGet();
- }
-
- public void incrementCachedPreparedStatementDeleteCount() {
- cachedPreparedStatementDeleteCount.incrementAndGet();
- }
-
- public void incrementCachedPreparedStatementMissCount() {
- cachedPreparedStatementMissCount.incrementAndGet();
- }
-
- public long getCachedPreparedStatementMissCount() {
- return cachedPreparedStatementMissCount.get();
- }
-
- public long getCachedPreparedStatementAccessCount() {
- return cachedPreparedStatementMissCount.get() + cachedPreparedStatementHitCount.get();
- }
-
- public long getCachedPreparedStatementDeleteCount() {
- return cachedPreparedStatementDeleteCount.get();
- }
-
- public long getCachedPreparedStatementCount() {
- return cachedPreparedStatementCount.get();
- }
-
- public void incrementClosedPreparedStatementCount() {
- closedPreparedStatementCount.incrementAndGet();
- }
-
- public long getClosedPreparedStatementCount() {
- return closedPreparedStatementCount.get();
- }
-
- public void incrementPreparedStatementCount() {
- preparedStatementCount.incrementAndGet();
- }
-
- public long getPreparedStatementCount() {
- return preparedStatementCount.get();
- }
-
- public void incrementCachedPreparedStatementHitCount() {
- cachedPreparedStatementHitCount.incrementAndGet();
- }
-
- public long getCachedPreparedStatementHitCount() {
- return cachedPreparedStatementHitCount.get();
- }
-
- public long getTransactionThresholdMillis() {
- return transactionThresholdMillis;
- }
-
- public void setTransactionThresholdMillis(long transactionThresholdMillis) {
- this.transactionThresholdMillis = transactionThresholdMillis;
- }
-
- public abstract void logTransaction(TransactionInfo info);
-
- public long[] getTransactionHistogramValues() {
- return transactionHistogram.toArray();
- }
-
- public long[] getTransactionHistogramRanges() {
- return transactionHistogram.getRanges();
- }
-
- public long getCommitCount() {
- return commitCount.get();
- }
-
- public void incrementCommitCount() {
- commitCount.incrementAndGet();
- }
-
- public long getRollbackCount() {
- return rollbackCount.get();
- }
-
- public void incrementRollbackCount() {
- rollbackCount.incrementAndGet();
- }
-
- public long getStartTransactionCount() {
- return startTransactionCount.get();
- }
-
- public void incrementStartTransactionCount() {
- startTransactionCount.incrementAndGet();
- }
-
- public boolean isBreakAfterAcquireFailure() {
- return breakAfterAcquireFailure;
- }
-
- public void setBreakAfterAcquireFailure(boolean breakAfterAcquireFailure) {
- this.breakAfterAcquireFailure = breakAfterAcquireFailure;
- }
-
- public int getConnectionErrorRetryAttempts() {
- return connectionErrorRetryAttempts;
- }
-
- public void setConnectionErrorRetryAttempts(int connectionErrorRetryAttempts) {
- this.connectionErrorRetryAttempts = connectionErrorRetryAttempts;
- }
-
- public long getDupCloseCount() {
- return dupCloseCount.get();
- }
-
- public int getMaxPoolPreparedStatementPerConnectionSize() {
- return maxPoolPreparedStatementPerConnectionSize;
- }
-
- public void setMaxPoolPreparedStatementPerConnectionSize(int maxPoolPreparedStatementPerConnectionSize) {
- if (maxPoolPreparedStatementPerConnectionSize > 0) {
- this.poolPreparedStatements = true;
- }
-
- this.maxPoolPreparedStatementPerConnectionSize = maxPoolPreparedStatementPerConnectionSize;
- }
-
- public boolean isSharePreparedStatements() {
- return sharePreparedStatements;
- }
-
- public void setSharePreparedStatements(boolean sharePreparedStatements) {
- this.sharePreparedStatements = sharePreparedStatements;
- }
-
- public void incrementDupCloseCount() {
- dupCloseCount.incrementAndGet();
- }
-
- public ValidConnectionChecker getValidConnectionChecker() {
- return validConnectionChecker;
- }
-
- public void setValidConnectionChecker(ValidConnectionChecker validConnectionChecker) {
- this.validConnectionChecker = validConnectionChecker;
- }
-
- public String getValidConnectionCheckerClassName() {
- if (validConnectionChecker == null) {
- return null;
- }
-
- return validConnectionChecker.getClass().getName();
- }
-
- public void setValidConnectionCheckerClassName(String validConnectionCheckerClass) throws Exception {
- Class> clazz = JdbcUtils.loadDriverClass(validConnectionCheckerClass);
- ValidConnectionChecker validConnectionChecker = null;
- if (clazz != null) {
- validConnectionChecker = (ValidConnectionChecker) clazz.newInstance();
- this.validConnectionChecker = validConnectionChecker;
- } else {
- LOG.error("load validConnectionCheckerClass error : " + validConnectionCheckerClass);
- }
- }
-
- public String getDbType() {
- return dbType;
- }
-
- public void setDbType(String dbType) {
- this.dbType = dbType;
- }
-
- public void addConnectionProperty(String name, String value) {
- if (inited) {
- throw new UnsupportedOperationException();
- }
-
- connectProperties.put(name, value);
- }
-
- public Collection getConnectionInitSqls() {
- Collection result = connectionInitSqls;
- if (result == null) {
- return Collections.emptyList();
- }
- return result;
- }
-
- public void setConnectionInitSqls(Collection