mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
JMX增强
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@684 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -74,7 +74,8 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
private long recycleCount = 0L;
|
||||
private long createConnectionCount = 0L;
|
||||
private long destroyCount = 0L;
|
||||
private long removeAbandonedCount = 0L;
|
||||
private long removeAbandonedCount = 0L;
|
||||
private long notEmptyWaitCount = 0L;
|
||||
|
||||
// store
|
||||
private ConnectionHolder[] connections;
|
||||
@@ -102,6 +103,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
createConnectionCount = 0;
|
||||
destroyCount = 0;
|
||||
removeAbandonedCount = 0;
|
||||
notEmptyWaitCount = 0;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
@@ -550,6 +552,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
while (poolingCount == 0) {
|
||||
empty.signal(); // send signal to CreateThread create connection
|
||||
notEmpty.await(); // signal by recycle or creator
|
||||
notEmptyWaitCount++;
|
||||
|
||||
if (!enable) {
|
||||
connectErrorCount++;
|
||||
@@ -581,6 +584,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
|
||||
try {
|
||||
estimate = notEmpty.awaitNanos(estimate); // signal by recycle or creator
|
||||
notEmptyWaitCount++;
|
||||
|
||||
if (!enable) {
|
||||
connectErrorCount++;
|
||||
@@ -939,6 +943,10 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
}
|
||||
}
|
||||
|
||||
public long getNotEmptyWaitCount() {
|
||||
return notEmptyWaitCount;
|
||||
}
|
||||
|
||||
public int getLockQueueLength() {
|
||||
return lock.getQueueLength();
|
||||
}
|
||||
|
||||
@@ -23,12 +23,14 @@ public interface DruidDataSourceMBean extends DruidAbstractDataSourceMBean {
|
||||
boolean isEnable();
|
||||
|
||||
void shrink();
|
||||
|
||||
|
||||
String toString();
|
||||
|
||||
|
||||
int getWaitThreadCount();
|
||||
|
||||
|
||||
int getLockQueueLength();
|
||||
|
||||
|
||||
long getNotEmptyWaitCount();
|
||||
|
||||
void resetStat();
|
||||
}
|
||||
|
||||
@@ -96,6 +96,8 @@ public class DruidDataSourceStatManager implements DruidDataSourceStatManagerMBe
|
||||
map.put("DriverClassName", dataSource.getDriverClassName());
|
||||
map.put("Username", dataSource.getUsername());
|
||||
map.put("RemoveAbandonedCount", dataSource.getRemoveAbandonedCount());
|
||||
|
||||
map.put("NotEmptyWaitCount", dataSource.getNotEmptyWaitCount());
|
||||
|
||||
return new CompositeDataSupport(rowType, map);
|
||||
}
|
||||
@@ -114,7 +116,8 @@ public class DruidDataSourceStatManager implements DruidDataSourceStatManagerMBe
|
||||
SimpleType.LONG, SimpleType.INTEGER, SimpleType.INTEGER, SimpleType.INTEGER, SimpleType.INTEGER, //
|
||||
SimpleType.INTEGER, SimpleType.INTEGER, SimpleType.INTEGER, SimpleType.BOOLEAN, SimpleType.BOOLEAN, //
|
||||
SimpleType.BOOLEAN, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.STRING, //
|
||||
SimpleType.STRING, SimpleType.INTEGER, SimpleType.STRING, SimpleType.STRING, SimpleType.LONG,
|
||||
SimpleType.STRING, SimpleType.INTEGER, SimpleType.STRING, SimpleType.STRING, SimpleType.LONG, //
|
||||
SimpleType.LONG,
|
||||
//
|
||||
};
|
||||
|
||||
@@ -124,7 +127,8 @@ public class DruidDataSourceStatManager implements DruidDataSourceStatManagerMBe
|
||||
"CloseCount", "ActiveCount", "PoolingCount", "LockQueueLength", "WaitThreadCount", //
|
||||
"InitialSize", "MaxActive", "MinIdle", "PoolPreparedStatements", "TestOnBorrow", //
|
||||
"TestOnReturn", "MinEvictableIdleTimeMillis", "ConnectErrorCount", "CreateTimespanMillis", "DbType", //
|
||||
"ValidationQuery", "ValidationQueryTimeout", "DriverClassName", "Username", "RemoveAbandonedCount"
|
||||
"ValidationQuery", "ValidationQueryTimeout", "DriverClassName", "Username", "RemoveAbandonedCount", //
|
||||
"NotEmptyWaitCount"
|
||||
//
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user