mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
jmx support enhanced
This commit is contained in:
@@ -94,6 +94,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
private int poolingCount = 0;
|
||||
private int activeCount = 0;
|
||||
private int notEmptyWaitThreadCount = 0;
|
||||
private int notEmptyWaitThreadPeak = 0;
|
||||
|
||||
// threads
|
||||
private CreateConnectionThread createConnectionThread;
|
||||
@@ -673,6 +674,9 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
while (poolingCount == 0) {
|
||||
empty.signal(); // send signal to CreateThread create connection
|
||||
notEmptyWaitThreadCount++;
|
||||
if (notEmptyWaitThreadCount > notEmptyWaitThreadPeak) {
|
||||
notEmptyWaitThreadPeak = notEmptyWaitThreadCount;
|
||||
}
|
||||
try {
|
||||
notEmpty.await(); // signal by recycle or creator
|
||||
} finally {
|
||||
@@ -710,6 +714,10 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
}
|
||||
|
||||
notEmptyWaitThreadCount++;
|
||||
if (notEmptyWaitThreadCount > notEmptyWaitThreadPeak) {
|
||||
notEmptyWaitThreadPeak = notEmptyWaitThreadCount;
|
||||
}
|
||||
|
||||
try {
|
||||
long startEstimate = estimate;
|
||||
estimate = notEmpty.awaitNanos(estimate); // signal by
|
||||
@@ -810,7 +818,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isBusy() {
|
||||
lock.lock();
|
||||
try {
|
||||
@@ -1142,6 +1150,15 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
public int getNotEmptyWaitThreadCount() {
|
||||
return notEmptyWaitThreadCount;
|
||||
}
|
||||
|
||||
public int getNotEmptyWaitThreadPeak() {
|
||||
lock.lock();
|
||||
try {
|
||||
return notEmptyWaitThreadPeak;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public long getNotEmptySignalCount() {
|
||||
return notEmptySignalCount;
|
||||
|
||||
Reference in New Issue
Block a user