mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
添加监控
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@902 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -87,6 +87,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
private int poolingCount = 0;
|
||||
private int activeCount = 0;
|
||||
private int notEmptyWaitThreadCount = 0;
|
||||
private int activePeak = 0;
|
||||
|
||||
// threads
|
||||
private CreateConnectionThread createConnectionThread;
|
||||
@@ -126,6 +127,8 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
notEmptyWaitCount = 0;
|
||||
notEmptySignalCount = 0L;
|
||||
notEmptyWaitNanos = 0;
|
||||
|
||||
activePeak = 0;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
@@ -412,6 +415,9 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
|
||||
holder.incrementUseCount();
|
||||
activeCount++;
|
||||
if (activeCount > activePeak) {
|
||||
activePeak = activeCount;
|
||||
}
|
||||
|
||||
poolalbeConnection = new PoolableConnection(holder);
|
||||
} catch (InterruptedException e) {
|
||||
@@ -1038,6 +1044,10 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
public int getLockQueueLength() {
|
||||
return lock.getQueueLength();
|
||||
}
|
||||
|
||||
public int getActivePeak() {
|
||||
return activePeak;
|
||||
}
|
||||
|
||||
public String dump() {
|
||||
lock.lock();
|
||||
|
||||
@@ -51,5 +51,5 @@ public interface DruidDataSourceMBean extends DruidAbstractDataSourceMBean {
|
||||
|
||||
String getVersion();
|
||||
|
||||
|
||||
int getActivePeak();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user