mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
more GetConnectionTimeout message info. add field 'creatingCount'
This commit is contained in:
@@ -38,6 +38,7 @@ import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.locks.Condition;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
@@ -222,6 +223,7 @@ public abstract class DruidAbstractDataSource extends WrapperAdapter implements
|
||||
protected volatile long lastErrorTimeMillis;
|
||||
protected volatile Throwable lastCreateError;
|
||||
protected volatile long lastCreateErrorTimeMillis;
|
||||
protected volatile long lastCreateStartTimeMillis;
|
||||
|
||||
protected boolean isOracle = false;
|
||||
|
||||
@@ -233,6 +235,7 @@ public abstract class DruidAbstractDataSource extends WrapperAdapter implements
|
||||
|
||||
protected ReentrantLock activeConnectionLock = new ReentrantLock();
|
||||
|
||||
protected AtomicInteger creatingCount = new AtomicInteger();
|
||||
protected AtomicLong createCount = new AtomicLong();
|
||||
protected AtomicLong destroyCount = new AtomicLong();
|
||||
|
||||
@@ -1521,6 +1524,7 @@ public abstract class DruidAbstractDataSource extends WrapperAdapter implements
|
||||
? new HashMap<String, Object>()
|
||||
: null;
|
||||
|
||||
creatingCount.incrementAndGet();
|
||||
try {
|
||||
conn = createPhysicalConnection(url, physicalConnectProperties);
|
||||
connectedNanos = System.nanoTime();
|
||||
@@ -1552,6 +1556,7 @@ public abstract class DruidAbstractDataSource extends WrapperAdapter implements
|
||||
} finally {
|
||||
long nano = System.nanoTime() - connectStartNanos;
|
||||
createTimespan += nano;
|
||||
creatingCount.decrementAndGet();
|
||||
}
|
||||
|
||||
return new PhysicalConnectionInfo(conn, connectStartNanos, connectedNanos, initedNanos, validatedNanos, variables, globalVariables);
|
||||
|
||||
@@ -1250,8 +1250,9 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("wait millis ")//
|
||||
.append(waitNanos / (1000 * 1000))//
|
||||
.append(", active " + activeCount)//
|
||||
.append(", maxActive " + maxActive)//
|
||||
.append(", active ").append(activeCount)//
|
||||
.append(", maxActive ").append(maxActive)//
|
||||
.append(", creating ").append(creatingCount.get())//
|
||||
;
|
||||
|
||||
List<JdbcSqlStatValue> sqlList = this.getDataSourceStat().getRuningSqlList();
|
||||
@@ -1262,8 +1263,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
buf.append(", ");
|
||||
}
|
||||
JdbcSqlStatValue sql = sqlList.get(i);
|
||||
buf.append("runningSqlCount ");
|
||||
buf.append(sql.getRunningCount());
|
||||
buf.append("runningSqlCount ").append(sql.getRunningCount());
|
||||
buf.append(" : ");
|
||||
buf.append(sql.getSql());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user