Skip to content

Commit

Permalink
revert commit 39e8b59 to fix CPU full usage issue
Browse files Browse the repository at this point in the history
  • Loading branch information
zrlw committed Nov 23, 2023
1 parent 8b4b363 commit 3e86d26
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -1690,7 +1690,6 @@ private DruidPooledConnection getConnectionInternal(long maxWait) throws SQLExce

DruidConnectionHolder holder;

long startTime = System.currentTimeMillis(); //进入循环等待之前,先记录开始尝试获取连接的时间
for (boolean createDirect = false; ; ) {
if (createDirect) {
createStartNanosUpdater.set(this, System.nanoTime());
Expand Down Expand Up @@ -1740,19 +1739,6 @@ private DruidPooledConnection getConnectionInternal(long maxWait) throws SQLExce
}

try {
if (activeCount >= maxActive) {
long waitedTime = System.currentTimeMillis() - startTime;
if (maxWait > 0 && waitedTime > maxWait) {
//连接池已满时,如果最大等待时间大于0,且循环等待时间已经大于最大等待时间,则需要抛出异常
connectErrorCountUpdater.incrementAndGet(this);
throw new GetConnectionTimeoutException(
"activeCount(" + activeCount + ")>= maxActive(" + maxActive + ") and waitedTime(" + waitedTime + "ms) > maxWait("
+ maxWait + "ms)");
}
createDirect = false;
continue;
}

if (maxWaitThreadCount > 0
&& notEmptyWaitThreadCount >= maxWaitThreadCount) {
connectErrorCountUpdater.incrementAndGet(this);
Expand Down

0 comments on commit 3e86d26

Please sign in to comment.