mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
merge from upstram
This commit is contained in:
@@ -19,7 +19,7 @@ public final class VERSION {
|
||||
|
||||
public final static int MajorVersion = 0;
|
||||
public final static int MinorVersion = 2;
|
||||
public final static int RevisionVersion = 19;
|
||||
public final static int RevisionVersion = 20;
|
||||
|
||||
public static String getVersionNumber() {
|
||||
return VERSION.MajorVersion + "." + VERSION.MinorVersion + "." + VERSION.RevisionVersion;
|
||||
|
||||
@@ -36,80 +36,80 @@ public class DruidDataSourceStatLoggerImpl implements DruidDataSourceStatLogger
|
||||
Map<String, Object> map = new LinkedHashMap<String, Object>();
|
||||
|
||||
map.put("url", statValue.url);
|
||||
map.put("dbType", statValue.dbType);
|
||||
map.put("name", statValue.name);
|
||||
map.put("activeCount", statValue.activeCount);
|
||||
map.put("dbType", statValue.getDbType());
|
||||
map.put("name", statValue.getName());
|
||||
map.put("activeCount", statValue.getActiveCount());
|
||||
|
||||
if (statValue.activePeak > 0) {
|
||||
map.put("activePeak", statValue.activePeak);
|
||||
map.put("activePeak", statValue.getActivePeak());
|
||||
map.put("activePeakTime", statValue.getActivePeakTime());
|
||||
}
|
||||
map.put("poolingCount", statValue.poolingCount);
|
||||
if (statValue.poolingPeak > 0) {
|
||||
map.put("poolingPeak", statValue.poolingPeak);
|
||||
map.put("poolingCount", statValue.getPoolingCount());
|
||||
if (statValue.getPoolingPeak() > 0) {
|
||||
map.put("poolingPeak", statValue.getPoolingPeak());
|
||||
map.put("poolingPeakTime", statValue.getPoolingPeakTime());
|
||||
}
|
||||
map.put("connectCount", statValue.connectCount);
|
||||
map.put("closeCount", statValue.closeCount);
|
||||
map.put("connectCount", statValue.getConnectCount());
|
||||
map.put("closeCount", statValue.getCloseCount());
|
||||
|
||||
if (statValue.waitThreadCount > 0) {
|
||||
map.put("waitThreadCount", statValue.waitThreadCount);
|
||||
if (statValue.getWaitThreadCount() > 0) {
|
||||
map.put("waitThreadCount", statValue.getWaitThreadCount());
|
||||
}
|
||||
if (statValue.notEmptyWaitCount > 0) {
|
||||
map.put("notEmptyWaitCount", statValue.notEmptyWaitCount);
|
||||
if (statValue.getNotEmptyWaitCount() > 0) {
|
||||
map.put("notEmptyWaitCount", statValue.getNotEmptyWaitCount());
|
||||
}
|
||||
if (statValue.getNotEmptyWaitMillis() > 0) {
|
||||
map.put("notEmptyWaitMillis", statValue.getNotEmptyWaitMillis());
|
||||
}
|
||||
if (statValue.logicConnectErrorCount > 0) {
|
||||
map.put("logicConnectErrorCount", statValue.logicConnectErrorCount);
|
||||
if (statValue.getLogicConnectErrorCount() > 0) {
|
||||
map.put("logicConnectErrorCount", statValue.getLogicConnectErrorCount());
|
||||
}
|
||||
if (statValue.physicalConnectCount > 0) {
|
||||
map.put("physicalConnectCount", statValue.physicalConnectCount);
|
||||
if (statValue.getPhysicalConnectCount() > 0) {
|
||||
map.put("physicalConnectCount", statValue.getPhysicalConnectCount());
|
||||
}
|
||||
if (statValue.physicalCloseCount > 0) {
|
||||
map.put("physicalCloseCount", statValue.physicalCloseCount);
|
||||
if (statValue.getPhysicalCloseCount() > 0) {
|
||||
map.put("physicalCloseCount", statValue.getPhysicalCloseCount());
|
||||
}
|
||||
if (statValue.physicalConnectErrorCount > 0) {
|
||||
map.put("physicalConnectErrorCount", statValue.physicalConnectErrorCount);
|
||||
if (statValue.getPhysicalConnectErrorCount() > 0) {
|
||||
map.put("physicalConnectErrorCount", statValue.getPhysicalConnectErrorCount());
|
||||
}
|
||||
if (statValue.executeCount > 0) {
|
||||
map.put("executeCount", statValue.executeCount);
|
||||
if (statValue.getExecuteCount() > 0) {
|
||||
map.put("executeCount", statValue.getExecuteCount());
|
||||
}
|
||||
if (statValue.errorCount > 0) {
|
||||
map.put("errorCount", statValue.errorCount);
|
||||
if (statValue.getErrorCount() > 0) {
|
||||
map.put("errorCount", statValue.getErrorCount());
|
||||
}
|
||||
if (statValue.commitCount > 0) {
|
||||
map.put("commitCount", statValue.commitCount);
|
||||
if (statValue.getCommitCount() > 0) {
|
||||
map.put("commitCount", statValue.getCommitCount());
|
||||
}
|
||||
if (statValue.rollbackCount > 0) {
|
||||
map.put("rollbackCount", statValue.rollbackCount);
|
||||
if (statValue.getRollbackCount() > 0) {
|
||||
map.put("rollbackCount", statValue.getRollbackCount());
|
||||
}
|
||||
if (statValue.pstmtCacheHitCount > 0) {
|
||||
map.put("pstmtCacheHitCount", statValue.pstmtCacheHitCount);
|
||||
if (statValue.getPstmtCacheHitCount() > 0) {
|
||||
map.put("pstmtCacheHitCount", statValue.getPstmtCacheHitCount());
|
||||
}
|
||||
if (statValue.pstmtCacheMissCount > 0) {
|
||||
map.put("pstmtCacheMissCount", statValue.pstmtCacheMissCount);
|
||||
if (statValue.getPstmtCacheMissCount() > 0) {
|
||||
map.put("pstmtCacheMissCount", statValue.getPstmtCacheMissCount());
|
||||
}
|
||||
if (statValue.startTransactionCount > 0) {
|
||||
map.put("startTransactionCount", statValue.startTransactionCount);
|
||||
map.put("transactionHistogram", rtrim(statValue.transactionHistogram));
|
||||
if (statValue.getStartTransactionCount() > 0) {
|
||||
map.put("startTransactionCount", statValue.getStartTransactionCount());
|
||||
map.put("transactionHistogram", rtrim(statValue.getTransactionHistogram()));
|
||||
}
|
||||
if (statValue.connectCount > 0) {
|
||||
map.put("connectionHoldTimeHistogram", rtrim(statValue.connectionHoldTimeHistogram));
|
||||
if (statValue.getConnectCount() > 0) {
|
||||
map.put("connectionHoldTimeHistogram", rtrim(statValue.getConnectionHoldTimeHistogram()));
|
||||
}
|
||||
if (statValue.clobOpenCount > 0) {
|
||||
map.put("clobOpenCount", statValue.clobOpenCount);
|
||||
if (statValue.getClobOpenCount() > 0) {
|
||||
map.put("clobOpenCount", statValue.getClobOpenCount());
|
||||
}
|
||||
if (statValue.blobOpenCount > 0) {
|
||||
map.put("blobOpenCount", statValue.blobOpenCount);
|
||||
if (statValue.getBlobOpenCount() > 0) {
|
||||
map.put("blobOpenCount", statValue.getBlobOpenCount());
|
||||
}
|
||||
|
||||
ArrayList<Map<String, Object>> sqlList = new ArrayList<Map<String, Object>>();
|
||||
if (statValue.sqlList.size() > 0) {
|
||||
for (JdbcSqlStatValue sqlStat : statValue.sqlList) {
|
||||
for (JdbcSqlStatValue sqlStat : statValue.getSqlList()) {
|
||||
Map<String, Object> sqlStatMap = new LinkedHashMap<String, Object>();
|
||||
sqlStatMap.put("sql", sqlStat.sql);
|
||||
sqlStatMap.put("sql", sqlStat.getSql());
|
||||
|
||||
if (sqlStat.getExecuteCount() > 0) {
|
||||
sqlStatMap.put("executeCount", sqlStat.getExecuteCount());
|
||||
@@ -121,36 +121,43 @@ public class DruidDataSourceStatLoggerImpl implements DruidDataSourceStatLogger
|
||||
rtrim(sqlStat.getExecuteAndResultHoldHistogram()));
|
||||
}
|
||||
|
||||
if (sqlStat.executeErrorCount > 0) {
|
||||
sqlStatMap.put("executeErrorCount", sqlStat.executeErrorCount);
|
||||
long executeErrorCount = sqlStat.getExecuteErrorCount();
|
||||
if (executeErrorCount > 0) {
|
||||
sqlStatMap.put("executeErrorCount", executeErrorCount);
|
||||
}
|
||||
if (sqlStat.runningCount > 0) {
|
||||
sqlStatMap.put("runningCount", sqlStat.runningCount);
|
||||
}
|
||||
sqlStatMap.put("concurrentMax", sqlStat.concurrentMax);
|
||||
|
||||
if (sqlStat.fetchRowCount > 0) {
|
||||
sqlStatMap.put("fetchRowCount", sqlStat.fetchRowCount);
|
||||
sqlStatMap.put("fetchRowCount", sqlStat.fetchRowCountMax);
|
||||
int runningCount = sqlStat.getRunningCount();
|
||||
if (runningCount > 0) {
|
||||
sqlStatMap.put("runningCount", runningCount);
|
||||
}
|
||||
|
||||
int concurrentMax = sqlStat.getConcurrentMax();
|
||||
if (concurrentMax > 0) {
|
||||
sqlStatMap.put("concurrentMax", concurrentMax);
|
||||
}
|
||||
|
||||
if (sqlStat.getFetchRowCount() > 0) {
|
||||
sqlStatMap.put("fetchRowCount", sqlStat.getFetchRowCount());
|
||||
sqlStatMap.put("fetchRowCount", sqlStat.getFetchRowCountMax());
|
||||
sqlStatMap.put("fetchRowHistogram", rtrim(sqlStat.getFetchRowHistogram()));
|
||||
}
|
||||
|
||||
if (sqlStat.updateCount > 0) {
|
||||
sqlStatMap.put("updateCount", sqlStat.updateCount);
|
||||
sqlStatMap.put("updateCountMax", sqlStat.updateCountMax);
|
||||
if (sqlStat.getUpdateCount() > 0) {
|
||||
sqlStatMap.put("updateCount", sqlStat.getUpdateCount());
|
||||
sqlStatMap.put("updateCountMax", sqlStat.getUpdateCountMax());
|
||||
sqlStatMap.put("updateHistogram", rtrim(sqlStat.getUpdateHistogram()));
|
||||
}
|
||||
|
||||
if (sqlStat.inTransactionCount > 0) {
|
||||
sqlStatMap.put("inTransactionCount", sqlStat.inTransactionCount);
|
||||
if (sqlStat.getInTransactionCount() > 0) {
|
||||
sqlStatMap.put("inTransactionCount", sqlStat.getInTransactionCount());
|
||||
}
|
||||
|
||||
if (sqlStat.clobOpenCount > 0) {
|
||||
sqlStatMap.put("clobOpenCount", sqlStat.clobOpenCount);
|
||||
if (sqlStat.getClobOpenCount() > 0) {
|
||||
sqlStatMap.put("clobOpenCount", sqlStat.getClobOpenCount());
|
||||
}
|
||||
|
||||
if (sqlStat.blobOpenCount > 0) {
|
||||
sqlStatMap.put("blobOpenCount", sqlStat.blobOpenCount);
|
||||
if (sqlStat.getBlobOpenCount() > 0) {
|
||||
sqlStatMap.put("blobOpenCount", sqlStat.getBlobOpenCount());
|
||||
}
|
||||
|
||||
sqlList.add(sqlStatMap);
|
||||
|
||||
@@ -22,61 +22,61 @@ import com.alibaba.druid.stat.JdbcSqlStatValue;
|
||||
|
||||
public class DruidDataSourceStatValue {
|
||||
|
||||
public String name;
|
||||
public String dbType;
|
||||
public String driverClassName;
|
||||
public String url;
|
||||
public String userName;
|
||||
public List<String> filterClassNames;
|
||||
public boolean removeAbandoned;
|
||||
protected String name;
|
||||
protected String dbType;
|
||||
protected String driverClassName;
|
||||
protected String url;
|
||||
protected String userName;
|
||||
protected List<String> filterClassNames;
|
||||
protected boolean removeAbandoned;
|
||||
|
||||
public int initialSize;
|
||||
public int minIdle;
|
||||
public int maxActive;
|
||||
public int queryTimeout;
|
||||
public int transactionQueryTimeout;
|
||||
public int loginTimeout;
|
||||
public String validConnectionCheckerClassName;
|
||||
public String exceptionSorterClassName;
|
||||
public boolean testOnBorrow;
|
||||
public boolean testOnReturn;
|
||||
public boolean testWhileIdle;
|
||||
public boolean defaultAutoCommit;
|
||||
public boolean defaultReadOnly;
|
||||
public Integer defaultTransactionIsolation;
|
||||
protected int initialSize;
|
||||
protected int minIdle;
|
||||
protected int maxActive;
|
||||
protected int queryTimeout;
|
||||
protected int transactionQueryTimeout;
|
||||
protected int loginTimeout;
|
||||
protected String validConnectionCheckerClassName;
|
||||
protected String exceptionSorterClassName;
|
||||
protected boolean testOnBorrow;
|
||||
protected boolean testOnReturn;
|
||||
protected boolean testWhileIdle;
|
||||
protected boolean defaultAutoCommit;
|
||||
protected boolean defaultReadOnly;
|
||||
protected Integer defaultTransactionIsolation;
|
||||
|
||||
public int activeCount;
|
||||
public int activePeak;
|
||||
public long activePeakTime;
|
||||
protected int activeCount;
|
||||
protected int activePeak;
|
||||
protected long activePeakTime;
|
||||
|
||||
public int poolingCount;
|
||||
public int poolingPeak;
|
||||
public long poolingPeakTime;
|
||||
protected int poolingCount;
|
||||
protected int poolingPeak;
|
||||
protected long poolingPeakTime;
|
||||
|
||||
public long connectCount;
|
||||
public long closeCount;
|
||||
public long waitThreadCount;
|
||||
public long notEmptyWaitCount;
|
||||
public long notEmptyWaitNanos;
|
||||
protected long connectCount;
|
||||
protected long closeCount;
|
||||
protected long waitThreadCount;
|
||||
protected long notEmptyWaitCount;
|
||||
protected long notEmptyWaitNanos;
|
||||
|
||||
public long logicConnectErrorCount;
|
||||
public long physicalConnectCount;
|
||||
public long physicalCloseCount;
|
||||
public long physicalConnectErrorCount;
|
||||
public long executeCount;
|
||||
public long errorCount;
|
||||
public long commitCount;
|
||||
public long rollbackCount;
|
||||
public long pstmtCacheHitCount;
|
||||
public long pstmtCacheMissCount;
|
||||
public long startTransactionCount;
|
||||
public long[] transactionHistogram;
|
||||
public long[] connectionHoldTimeHistogram;
|
||||
protected long logicConnectErrorCount;
|
||||
protected long physicalConnectCount;
|
||||
protected long physicalCloseCount;
|
||||
protected long physicalConnectErrorCount;
|
||||
protected long executeCount;
|
||||
protected long errorCount;
|
||||
protected long commitCount;
|
||||
protected long rollbackCount;
|
||||
protected long pstmtCacheHitCount;
|
||||
protected long pstmtCacheMissCount;
|
||||
protected long startTransactionCount;
|
||||
protected long[] transactionHistogram;
|
||||
protected long[] connectionHoldTimeHistogram;
|
||||
|
||||
public long clobOpenCount;
|
||||
public long blobOpenCount;
|
||||
protected long clobOpenCount;
|
||||
protected long blobOpenCount;
|
||||
|
||||
public List<JdbcSqlStatValue> sqlList;
|
||||
protected List<JdbcSqlStatValue> sqlList;
|
||||
|
||||
public Date getPoolingPeakTime() {
|
||||
if (poolingPeakTime <= 0) {
|
||||
@@ -97,4 +97,476 @@ public class DruidDataSourceStatValue {
|
||||
public long getNotEmptyWaitMillis() {
|
||||
return notEmptyWaitNanos / (1000 * 1000);
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public String getDbType() {
|
||||
return dbType;
|
||||
}
|
||||
|
||||
|
||||
public void setDbType(String dbType) {
|
||||
this.dbType = dbType;
|
||||
}
|
||||
|
||||
|
||||
public String getDriverClassName() {
|
||||
return driverClassName;
|
||||
}
|
||||
|
||||
|
||||
public void setDriverClassName(String driverClassName) {
|
||||
this.driverClassName = driverClassName;
|
||||
}
|
||||
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
|
||||
public List<String> getFilterClassNames() {
|
||||
return filterClassNames;
|
||||
}
|
||||
|
||||
|
||||
public void setFilterClassNames(List<String> filterClassNames) {
|
||||
this.filterClassNames = filterClassNames;
|
||||
}
|
||||
|
||||
|
||||
public boolean isRemoveAbandoned() {
|
||||
return removeAbandoned;
|
||||
}
|
||||
|
||||
|
||||
public void setRemoveAbandoned(boolean removeAbandoned) {
|
||||
this.removeAbandoned = removeAbandoned;
|
||||
}
|
||||
|
||||
|
||||
public int getInitialSize() {
|
||||
return initialSize;
|
||||
}
|
||||
|
||||
|
||||
public void setInitialSize(int initialSize) {
|
||||
this.initialSize = initialSize;
|
||||
}
|
||||
|
||||
|
||||
public int getMinIdle() {
|
||||
return minIdle;
|
||||
}
|
||||
|
||||
|
||||
public void setMinIdle(int minIdle) {
|
||||
this.minIdle = minIdle;
|
||||
}
|
||||
|
||||
|
||||
public int getMaxActive() {
|
||||
return maxActive;
|
||||
}
|
||||
|
||||
|
||||
public void setMaxActive(int maxActive) {
|
||||
this.maxActive = maxActive;
|
||||
}
|
||||
|
||||
|
||||
public int getQueryTimeout() {
|
||||
return queryTimeout;
|
||||
}
|
||||
|
||||
|
||||
public void setQueryTimeout(int queryTimeout) {
|
||||
this.queryTimeout = queryTimeout;
|
||||
}
|
||||
|
||||
|
||||
public int getTransactionQueryTimeout() {
|
||||
return transactionQueryTimeout;
|
||||
}
|
||||
|
||||
|
||||
public void setTransactionQueryTimeout(int transactionQueryTimeout) {
|
||||
this.transactionQueryTimeout = transactionQueryTimeout;
|
||||
}
|
||||
|
||||
|
||||
public int getLoginTimeout() {
|
||||
return loginTimeout;
|
||||
}
|
||||
|
||||
|
||||
public void setLoginTimeout(int loginTimeout) {
|
||||
this.loginTimeout = loginTimeout;
|
||||
}
|
||||
|
||||
|
||||
public String getValidConnectionCheckerClassName() {
|
||||
return validConnectionCheckerClassName;
|
||||
}
|
||||
|
||||
|
||||
public void setValidConnectionCheckerClassName(String validConnectionCheckerClassName) {
|
||||
this.validConnectionCheckerClassName = validConnectionCheckerClassName;
|
||||
}
|
||||
|
||||
|
||||
public String getExceptionSorterClassName() {
|
||||
return exceptionSorterClassName;
|
||||
}
|
||||
|
||||
|
||||
public void setExceptionSorterClassName(String exceptionSorterClassName) {
|
||||
this.exceptionSorterClassName = exceptionSorterClassName;
|
||||
}
|
||||
|
||||
|
||||
public boolean isTestOnBorrow() {
|
||||
return testOnBorrow;
|
||||
}
|
||||
|
||||
|
||||
public void setTestOnBorrow(boolean testOnBorrow) {
|
||||
this.testOnBorrow = testOnBorrow;
|
||||
}
|
||||
|
||||
|
||||
public boolean isTestOnReturn() {
|
||||
return testOnReturn;
|
||||
}
|
||||
|
||||
|
||||
public void setTestOnReturn(boolean testOnReturn) {
|
||||
this.testOnReturn = testOnReturn;
|
||||
}
|
||||
|
||||
|
||||
public boolean isTestWhileIdle() {
|
||||
return testWhileIdle;
|
||||
}
|
||||
|
||||
|
||||
public void setTestWhileIdle(boolean testWhileIdle) {
|
||||
this.testWhileIdle = testWhileIdle;
|
||||
}
|
||||
|
||||
|
||||
public boolean isDefaultAutoCommit() {
|
||||
return defaultAutoCommit;
|
||||
}
|
||||
|
||||
|
||||
public void setDefaultAutoCommit(boolean defaultAutoCommit) {
|
||||
this.defaultAutoCommit = defaultAutoCommit;
|
||||
}
|
||||
|
||||
|
||||
public boolean isDefaultReadOnly() {
|
||||
return defaultReadOnly;
|
||||
}
|
||||
|
||||
|
||||
public void setDefaultReadOnly(boolean defaultReadOnly) {
|
||||
this.defaultReadOnly = defaultReadOnly;
|
||||
}
|
||||
|
||||
|
||||
public Integer getDefaultTransactionIsolation() {
|
||||
return defaultTransactionIsolation;
|
||||
}
|
||||
|
||||
|
||||
public void setDefaultTransactionIsolation(Integer defaultTransactionIsolation) {
|
||||
this.defaultTransactionIsolation = defaultTransactionIsolation;
|
||||
}
|
||||
|
||||
|
||||
public int getActiveCount() {
|
||||
return activeCount;
|
||||
}
|
||||
|
||||
|
||||
public void setActiveCount(int activeCount) {
|
||||
this.activeCount = activeCount;
|
||||
}
|
||||
|
||||
|
||||
public int getActivePeak() {
|
||||
return activePeak;
|
||||
}
|
||||
|
||||
|
||||
public void setActivePeak(int activePeak) {
|
||||
this.activePeak = activePeak;
|
||||
}
|
||||
|
||||
|
||||
public int getPoolingCount() {
|
||||
return poolingCount;
|
||||
}
|
||||
|
||||
|
||||
public void setPoolingCount(int poolingCount) {
|
||||
this.poolingCount = poolingCount;
|
||||
}
|
||||
|
||||
|
||||
public int getPoolingPeak() {
|
||||
return poolingPeak;
|
||||
}
|
||||
|
||||
|
||||
public void setPoolingPeak(int poolingPeak) {
|
||||
this.poolingPeak = poolingPeak;
|
||||
}
|
||||
|
||||
|
||||
public long getConnectCount() {
|
||||
return connectCount;
|
||||
}
|
||||
|
||||
|
||||
public void setConnectCount(long connectCount) {
|
||||
this.connectCount = connectCount;
|
||||
}
|
||||
|
||||
|
||||
public long getCloseCount() {
|
||||
return closeCount;
|
||||
}
|
||||
|
||||
|
||||
public void setCloseCount(long closeCount) {
|
||||
this.closeCount = closeCount;
|
||||
}
|
||||
|
||||
|
||||
public long getWaitThreadCount() {
|
||||
return waitThreadCount;
|
||||
}
|
||||
|
||||
|
||||
public void setWaitThreadCount(long waitThreadCount) {
|
||||
this.waitThreadCount = waitThreadCount;
|
||||
}
|
||||
|
||||
|
||||
public long getNotEmptyWaitCount() {
|
||||
return notEmptyWaitCount;
|
||||
}
|
||||
|
||||
|
||||
public void setNotEmptyWaitCount(long notEmptyWaitCount) {
|
||||
this.notEmptyWaitCount = notEmptyWaitCount;
|
||||
}
|
||||
|
||||
|
||||
public long getNotEmptyWaitNanos() {
|
||||
return notEmptyWaitNanos;
|
||||
}
|
||||
|
||||
|
||||
public void setNotEmptyWaitNanos(long notEmptyWaitNanos) {
|
||||
this.notEmptyWaitNanos = notEmptyWaitNanos;
|
||||
}
|
||||
|
||||
|
||||
public long getLogicConnectErrorCount() {
|
||||
return logicConnectErrorCount;
|
||||
}
|
||||
|
||||
|
||||
public void setLogicConnectErrorCount(long logicConnectErrorCount) {
|
||||
this.logicConnectErrorCount = logicConnectErrorCount;
|
||||
}
|
||||
|
||||
|
||||
public long getPhysicalConnectCount() {
|
||||
return physicalConnectCount;
|
||||
}
|
||||
|
||||
|
||||
public void setPhysicalConnectCount(long physicalConnectCount) {
|
||||
this.physicalConnectCount = physicalConnectCount;
|
||||
}
|
||||
|
||||
|
||||
public long getPhysicalCloseCount() {
|
||||
return physicalCloseCount;
|
||||
}
|
||||
|
||||
|
||||
public void setPhysicalCloseCount(long physicalCloseCount) {
|
||||
this.physicalCloseCount = physicalCloseCount;
|
||||
}
|
||||
|
||||
|
||||
public long getPhysicalConnectErrorCount() {
|
||||
return physicalConnectErrorCount;
|
||||
}
|
||||
|
||||
|
||||
public void setPhysicalConnectErrorCount(long physicalConnectErrorCount) {
|
||||
this.physicalConnectErrorCount = physicalConnectErrorCount;
|
||||
}
|
||||
|
||||
|
||||
public long getExecuteCount() {
|
||||
return executeCount;
|
||||
}
|
||||
|
||||
|
||||
public void setExecuteCount(long executeCount) {
|
||||
this.executeCount = executeCount;
|
||||
}
|
||||
|
||||
|
||||
public long getErrorCount() {
|
||||
return errorCount;
|
||||
}
|
||||
|
||||
|
||||
public void setErrorCount(long errorCount) {
|
||||
this.errorCount = errorCount;
|
||||
}
|
||||
|
||||
|
||||
public long getCommitCount() {
|
||||
return commitCount;
|
||||
}
|
||||
|
||||
|
||||
public void setCommitCount(long commitCount) {
|
||||
this.commitCount = commitCount;
|
||||
}
|
||||
|
||||
|
||||
public long getRollbackCount() {
|
||||
return rollbackCount;
|
||||
}
|
||||
|
||||
|
||||
public void setRollbackCount(long rollbackCount) {
|
||||
this.rollbackCount = rollbackCount;
|
||||
}
|
||||
|
||||
|
||||
public long getPstmtCacheHitCount() {
|
||||
return pstmtCacheHitCount;
|
||||
}
|
||||
|
||||
|
||||
public void setPstmtCacheHitCount(long pstmtCacheHitCount) {
|
||||
this.pstmtCacheHitCount = pstmtCacheHitCount;
|
||||
}
|
||||
|
||||
|
||||
public long getPstmtCacheMissCount() {
|
||||
return pstmtCacheMissCount;
|
||||
}
|
||||
|
||||
|
||||
public void setPstmtCacheMissCount(long pstmtCacheMissCount) {
|
||||
this.pstmtCacheMissCount = pstmtCacheMissCount;
|
||||
}
|
||||
|
||||
|
||||
public long getStartTransactionCount() {
|
||||
return startTransactionCount;
|
||||
}
|
||||
|
||||
|
||||
public void setStartTransactionCount(long startTransactionCount) {
|
||||
this.startTransactionCount = startTransactionCount;
|
||||
}
|
||||
|
||||
|
||||
public long[] getTransactionHistogram() {
|
||||
return transactionHistogram;
|
||||
}
|
||||
|
||||
|
||||
public void setTransactionHistogram(long[] transactionHistogram) {
|
||||
this.transactionHistogram = transactionHistogram;
|
||||
}
|
||||
|
||||
|
||||
public long[] getConnectionHoldTimeHistogram() {
|
||||
return connectionHoldTimeHistogram;
|
||||
}
|
||||
|
||||
|
||||
public void setConnectionHoldTimeHistogram(long[] connectionHoldTimeHistogram) {
|
||||
this.connectionHoldTimeHistogram = connectionHoldTimeHistogram;
|
||||
}
|
||||
|
||||
|
||||
public long getClobOpenCount() {
|
||||
return clobOpenCount;
|
||||
}
|
||||
|
||||
|
||||
public void setClobOpenCount(long clobOpenCount) {
|
||||
this.clobOpenCount = clobOpenCount;
|
||||
}
|
||||
|
||||
|
||||
public long getBlobOpenCount() {
|
||||
return blobOpenCount;
|
||||
}
|
||||
|
||||
|
||||
public void setBlobOpenCount(long blobOpenCount) {
|
||||
this.blobOpenCount = blobOpenCount;
|
||||
}
|
||||
|
||||
|
||||
public List<JdbcSqlStatValue> getSqlList() {
|
||||
return sqlList;
|
||||
}
|
||||
|
||||
|
||||
public void setSqlList(List<JdbcSqlStatValue> sqlList) {
|
||||
this.sqlList = sqlList;
|
||||
}
|
||||
|
||||
|
||||
public void setActivePeakTime(long activePeakTime) {
|
||||
this.activePeakTime = activePeakTime;
|
||||
}
|
||||
|
||||
|
||||
public void setPoolingPeakTime(long poolingPeakTime) {
|
||||
this.poolingPeakTime = poolingPeakTime;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class SQLEvalVisitorUtils {
|
||||
if (JdbcUtils.MYSQL.equals(dbType)) {
|
||||
return new MySqlEvalVisitorImpl();
|
||||
}
|
||||
|
||||
|
||||
if (JdbcUtils.MARIADB.equals(dbType)) {
|
||||
return new MySqlEvalVisitorImpl();
|
||||
}
|
||||
@@ -1364,19 +1364,23 @@ public class SQLEvalVisitorUtils {
|
||||
}
|
||||
|
||||
if (a instanceof Long || b instanceof Long) {
|
||||
return castToLong(a) == castToLong(b);
|
||||
return castToLong(a).equals(castToLong(b));
|
||||
}
|
||||
|
||||
if (a instanceof Integer || b instanceof Integer) {
|
||||
return castToInteger(a) == castToInteger(b);
|
||||
return castToInteger(a).equals(castToInteger(b));
|
||||
}
|
||||
|
||||
if (a instanceof Short || b instanceof Short) {
|
||||
return castToShort(a) == castToShort(b);
|
||||
return castToShort(a).equals(castToShort(b));
|
||||
}
|
||||
|
||||
if (a instanceof Boolean || b instanceof Boolean) {
|
||||
return castToBoolean(a).equals(castToBoolean(b));
|
||||
}
|
||||
|
||||
if (a instanceof Byte || b instanceof Byte) {
|
||||
return castToByte(a) == castToByte(b);
|
||||
return castToByte(a).equals(castToByte(b));
|
||||
}
|
||||
|
||||
if (a instanceof Date || b instanceof Date) {
|
||||
@@ -1434,6 +1438,13 @@ public class SQLEvalVisitorUtils {
|
||||
return castToShort(a) + castToShort(b);
|
||||
}
|
||||
|
||||
if (a instanceof Boolean || b instanceof Boolean) {
|
||||
int aI = 0, bI = 0;
|
||||
if (castToBoolean(a)) aI = 1;
|
||||
if (castToBoolean(b)) bI = 1;
|
||||
return aI + bI;
|
||||
}
|
||||
|
||||
if (a instanceof Byte || b instanceof Byte) {
|
||||
return castToByte(a) + castToByte(b);
|
||||
}
|
||||
@@ -1486,6 +1497,13 @@ public class SQLEvalVisitorUtils {
|
||||
return castToShort(a) - castToShort(b);
|
||||
}
|
||||
|
||||
if (a instanceof Boolean || b instanceof Boolean) {
|
||||
int aI = 0, bI = 0;
|
||||
if (castToBoolean(a)) aI = 1;
|
||||
if (castToBoolean(b)) bI = 1;
|
||||
return aI - bI;
|
||||
}
|
||||
|
||||
if (a instanceof Byte || b instanceof Byte) {
|
||||
return castToByte(a) - castToByte(b);
|
||||
}
|
||||
@@ -1494,7 +1512,8 @@ public class SQLEvalVisitorUtils {
|
||||
return castToLong(a) - castToLong(b);
|
||||
}
|
||||
|
||||
return SQLEvalVisitor.EVAL_ERROR;
|
||||
// return SQLEvalVisitor.EVAL_ERROR;
|
||||
throw new IllegalArgumentException(a.getClass() + " and " + b.getClass() + " not supported.");
|
||||
}
|
||||
|
||||
public static Object multi(Object a, Object b) {
|
||||
|
||||
@@ -17,57 +17,57 @@ package com.alibaba.druid.stat;
|
||||
|
||||
public class JdbcSqlStatValue {
|
||||
|
||||
public String sql;
|
||||
public long id;
|
||||
public String dataSource;
|
||||
public long executeLastStartTime;
|
||||
protected String sql;
|
||||
protected long id;
|
||||
protected String dataSource;
|
||||
protected long executeLastStartTime;
|
||||
|
||||
public long executeBatchSizeTotal;
|
||||
public int executeBatchSizeMax;
|
||||
protected long executeBatchSizeTotal;
|
||||
protected int executeBatchSizeMax;
|
||||
|
||||
public long executeSuccessCount;
|
||||
public long executeSpanNanoTotal;
|
||||
public long executeSpanNanoMax;
|
||||
public int runningCount;
|
||||
public int concurrentMax;
|
||||
public long resultSetHoldTimeNano;
|
||||
public long executeAndResultSetHoldTime;
|
||||
protected long executeSuccessCount;
|
||||
protected long executeSpanNanoTotal;
|
||||
protected long executeSpanNanoMax;
|
||||
protected int runningCount;
|
||||
protected int concurrentMax;
|
||||
protected long resultSetHoldTimeNano;
|
||||
protected long executeAndResultSetHoldTime;
|
||||
|
||||
public String name;
|
||||
public String file;
|
||||
public String dbType;
|
||||
protected String name;
|
||||
protected String file;
|
||||
protected String dbType;
|
||||
|
||||
public long executeNanoSpanMaxOccurTime;
|
||||
protected long executeNanoSpanMaxOccurTime;
|
||||
|
||||
public long executeErrorCount;
|
||||
public Throwable executeErrorLast;
|
||||
public long executeErrorLastTime;
|
||||
protected long executeErrorCount;
|
||||
protected Throwable executeErrorLast;
|
||||
protected long executeErrorLastTime;
|
||||
|
||||
public long updateCount;
|
||||
public long updateCountMax;
|
||||
public long fetchRowCount;
|
||||
public long fetchRowCountMax;
|
||||
protected long updateCount;
|
||||
protected long updateCountMax;
|
||||
protected long fetchRowCount;
|
||||
protected long fetchRowCountMax;
|
||||
|
||||
public long inTransactionCount;
|
||||
protected long inTransactionCount;
|
||||
|
||||
public String lastSlowParameters;
|
||||
protected String lastSlowParameters;
|
||||
|
||||
public long clobOpenCount;
|
||||
public long blobOpenCount;
|
||||
public long readStringLength;
|
||||
public long readBytesLength;
|
||||
protected long clobOpenCount;
|
||||
protected long blobOpenCount;
|
||||
protected long readStringLength;
|
||||
protected long readBytesLength;
|
||||
|
||||
public long inputStreamOpenCount;
|
||||
public long readerOpenCount;
|
||||
protected long inputStreamOpenCount;
|
||||
protected long readerOpenCount;
|
||||
|
||||
public long histogram_0_1;
|
||||
public long histogram_1_10;
|
||||
public int histogram_10_100;
|
||||
public int histogram_100_1000;
|
||||
public int histogram_1000_10000;
|
||||
public int histogram_10000_100000;
|
||||
public int histogram_100000_1000000;
|
||||
public int histogram_1000000_more;
|
||||
protected long histogram_0_1;
|
||||
protected long histogram_1_10;
|
||||
protected int histogram_10_100;
|
||||
protected int histogram_100_1000;
|
||||
protected int histogram_1000_10000;
|
||||
protected int histogram_10000_100000;
|
||||
protected int histogram_100000_1000000;
|
||||
protected int histogram_1000000_more;
|
||||
|
||||
public long[] getExecuteHistogram() {
|
||||
return new long[] { histogram_0_1, //
|
||||
@@ -143,8 +143,265 @@ public class JdbcSqlStatValue {
|
||||
public long getExecuteMillisMax() {
|
||||
return executeSpanNanoMax / (1000 * 1000);
|
||||
}
|
||||
|
||||
|
||||
public long getExecuteMillisTotal() {
|
||||
return executeSpanNanoTotal / (1000 * 1000);
|
||||
}
|
||||
|
||||
public String getSql() {
|
||||
return sql;
|
||||
}
|
||||
|
||||
public void setSql(String sql) {
|
||||
this.sql = sql;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDataSource() {
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
public void setDataSource(String dataSource) {
|
||||
this.dataSource = dataSource;
|
||||
}
|
||||
|
||||
public long getExecuteLastStartTime() {
|
||||
return executeLastStartTime;
|
||||
}
|
||||
|
||||
public void setExecuteLastStartTime(long executeLastStartTime) {
|
||||
this.executeLastStartTime = executeLastStartTime;
|
||||
}
|
||||
|
||||
public long getExecuteBatchSizeTotal() {
|
||||
return executeBatchSizeTotal;
|
||||
}
|
||||
|
||||
public void setExecuteBatchSizeTotal(long executeBatchSizeTotal) {
|
||||
this.executeBatchSizeTotal = executeBatchSizeTotal;
|
||||
}
|
||||
|
||||
public int getExecuteBatchSizeMax() {
|
||||
return executeBatchSizeMax;
|
||||
}
|
||||
|
||||
public void setExecuteBatchSizeMax(int executeBatchSizeMax) {
|
||||
this.executeBatchSizeMax = executeBatchSizeMax;
|
||||
}
|
||||
|
||||
public long getExecuteSuccessCount() {
|
||||
return executeSuccessCount;
|
||||
}
|
||||
|
||||
public void setExecuteSuccessCount(long executeSuccessCount) {
|
||||
this.executeSuccessCount = executeSuccessCount;
|
||||
}
|
||||
|
||||
public long getExecuteSpanNanoTotal() {
|
||||
return executeSpanNanoTotal;
|
||||
}
|
||||
|
||||
public void setExecuteSpanNanoTotal(long executeSpanNanoTotal) {
|
||||
this.executeSpanNanoTotal = executeSpanNanoTotal;
|
||||
}
|
||||
|
||||
public long getExecuteSpanNanoMax() {
|
||||
return executeSpanNanoMax;
|
||||
}
|
||||
|
||||
public void setExecuteSpanNanoMax(long executeSpanNanoMax) {
|
||||
this.executeSpanNanoMax = executeSpanNanoMax;
|
||||
}
|
||||
|
||||
public int getRunningCount() {
|
||||
return runningCount;
|
||||
}
|
||||
|
||||
public void setRunningCount(int runningCount) {
|
||||
this.runningCount = runningCount;
|
||||
}
|
||||
|
||||
public int getConcurrentMax() {
|
||||
return concurrentMax;
|
||||
}
|
||||
|
||||
public void setConcurrentMax(int concurrentMax) {
|
||||
this.concurrentMax = concurrentMax;
|
||||
}
|
||||
|
||||
public long getResultSetHoldTimeNano() {
|
||||
return resultSetHoldTimeNano;
|
||||
}
|
||||
|
||||
public void setResultSetHoldTimeNano(long resultSetHoldTimeNano) {
|
||||
this.resultSetHoldTimeNano = resultSetHoldTimeNano;
|
||||
}
|
||||
|
||||
public long getExecuteAndResultSetHoldTime() {
|
||||
return executeAndResultSetHoldTime;
|
||||
}
|
||||
|
||||
public void setExecuteAndResultSetHoldTime(long executeAndResultSetHoldTime) {
|
||||
this.executeAndResultSetHoldTime = executeAndResultSetHoldTime;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
public void setFile(String file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public String getDbType() {
|
||||
return dbType;
|
||||
}
|
||||
|
||||
public void setDbType(String dbType) {
|
||||
this.dbType = dbType;
|
||||
}
|
||||
|
||||
public long getExecuteNanoSpanMaxOccurTime() {
|
||||
return executeNanoSpanMaxOccurTime;
|
||||
}
|
||||
|
||||
public void setExecuteNanoSpanMaxOccurTime(long executeNanoSpanMaxOccurTime) {
|
||||
this.executeNanoSpanMaxOccurTime = executeNanoSpanMaxOccurTime;
|
||||
}
|
||||
|
||||
public long getExecuteErrorCount() {
|
||||
return executeErrorCount;
|
||||
}
|
||||
|
||||
public void setExecuteErrorCount(long executeErrorCount) {
|
||||
this.executeErrorCount = executeErrorCount;
|
||||
}
|
||||
|
||||
public Throwable getExecuteErrorLast() {
|
||||
return executeErrorLast;
|
||||
}
|
||||
|
||||
public void setExecuteErrorLast(Throwable executeErrorLast) {
|
||||
this.executeErrorLast = executeErrorLast;
|
||||
}
|
||||
|
||||
public long getExecuteErrorLastTime() {
|
||||
return executeErrorLastTime;
|
||||
}
|
||||
|
||||
public void setExecuteErrorLastTime(long executeErrorLastTime) {
|
||||
this.executeErrorLastTime = executeErrorLastTime;
|
||||
}
|
||||
|
||||
public long getUpdateCount() {
|
||||
return updateCount;
|
||||
}
|
||||
|
||||
public void setUpdateCount(long updateCount) {
|
||||
this.updateCount = updateCount;
|
||||
}
|
||||
|
||||
public long getUpdateCountMax() {
|
||||
return updateCountMax;
|
||||
}
|
||||
|
||||
public void setUpdateCountMax(long updateCountMax) {
|
||||
this.updateCountMax = updateCountMax;
|
||||
}
|
||||
|
||||
public long getFetchRowCount() {
|
||||
return fetchRowCount;
|
||||
}
|
||||
|
||||
public void setFetchRowCount(long fetchRowCount) {
|
||||
this.fetchRowCount = fetchRowCount;
|
||||
}
|
||||
|
||||
public long getFetchRowCountMax() {
|
||||
return fetchRowCountMax;
|
||||
}
|
||||
|
||||
public void setFetchRowCountMax(long fetchRowCountMax) {
|
||||
this.fetchRowCountMax = fetchRowCountMax;
|
||||
}
|
||||
|
||||
public long getInTransactionCount() {
|
||||
return inTransactionCount;
|
||||
}
|
||||
|
||||
public void setInTransactionCount(long inTransactionCount) {
|
||||
this.inTransactionCount = inTransactionCount;
|
||||
}
|
||||
|
||||
public String getLastSlowParameters() {
|
||||
return lastSlowParameters;
|
||||
}
|
||||
|
||||
public void setLastSlowParameters(String lastSlowParameters) {
|
||||
this.lastSlowParameters = lastSlowParameters;
|
||||
}
|
||||
|
||||
public long getClobOpenCount() {
|
||||
return clobOpenCount;
|
||||
}
|
||||
|
||||
public void setClobOpenCount(long clobOpenCount) {
|
||||
this.clobOpenCount = clobOpenCount;
|
||||
}
|
||||
|
||||
public long getBlobOpenCount() {
|
||||
return blobOpenCount;
|
||||
}
|
||||
|
||||
public void setBlobOpenCount(long blobOpenCount) {
|
||||
this.blobOpenCount = blobOpenCount;
|
||||
}
|
||||
|
||||
public long getReadStringLength() {
|
||||
return readStringLength;
|
||||
}
|
||||
|
||||
public void setReadStringLength(long readStringLength) {
|
||||
this.readStringLength = readStringLength;
|
||||
}
|
||||
|
||||
public long getReadBytesLength() {
|
||||
return readBytesLength;
|
||||
}
|
||||
|
||||
public void setReadBytesLength(long readBytesLength) {
|
||||
this.readBytesLength = readBytesLength;
|
||||
}
|
||||
|
||||
public long getInputStreamOpenCount() {
|
||||
return inputStreamOpenCount;
|
||||
}
|
||||
|
||||
public void setInputStreamOpenCount(long inputStreamOpenCount) {
|
||||
this.inputStreamOpenCount = inputStreamOpenCount;
|
||||
}
|
||||
|
||||
public long getReaderOpenCount() {
|
||||
return readerOpenCount;
|
||||
}
|
||||
|
||||
public void setReaderOpenCount(long readerOpenCount) {
|
||||
this.readerOpenCount = readerOpenCount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@ public class LogFactory {
|
||||
// TODO add slf4j logging
|
||||
|
||||
// 优先选择log4j,而非Apache Common Logging. 因为后者无法设置真实Log调用者的信息
|
||||
tryImplementation("org.slf4j.Logger", "com.alibaba.druid.support.logging.SLF4JImpl");
|
||||
tryImplementation("org.apache.log4j.Logger", "com.alibaba.druid.support.logging.Log4jImpl");
|
||||
tryImplementation("java.util.logging.Logger", "com.alibaba.druid.support.logging.Jdk14LoggingImpl");
|
||||
tryImplementation("org.slf4j.Logger", "com.alibaba.druid.support.logging.SLF4JImpl");
|
||||
tryImplementation("org.apache.commons.logging.LogFactory",
|
||||
"com.alibaba.druid.support.logging.JakartaCommonsLoggingImpl");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user