diff --git a/core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java b/core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java index 68f9d6349f..e8137e898c 100644 --- a/core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java +++ b/core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java @@ -1740,7 +1740,7 @@ private DruidPooledConnection getConnectionInternal(long maxWait) throws SQLExce try { if (maxWaitThreadCount > 0 - && notEmptyWaitThreadCount >= maxWaitThreadCount) { + && notEmptyWaitThreadCount > maxWaitThreadCount) { connectErrorCountUpdater.incrementAndGet(this); throw new SQLException("maxWaitThreadCount " + maxWaitThreadCount + ", current wait Thread count " + lock.getQueueLength()); diff --git a/core/src/test/java/com/alibaba/druid/bvt/pool/DruidDataSourceTest_notEmptyWait.java b/core/src/test/java/com/alibaba/druid/bvt/pool/DruidDataSourceTest_notEmptyWait.java index 37bb9b208f..664a943e0d 100644 --- a/core/src/test/java/com/alibaba/druid/bvt/pool/DruidDataSourceTest_notEmptyWait.java +++ b/core/src/test/java/com/alibaba/druid/bvt/pool/DruidDataSourceTest_notEmptyWait.java @@ -75,8 +75,8 @@ public void run() { Thread.sleep(10); } - Assert.assertEquals(0, dataSource.getNotEmptyWaitThreadCount()); - Assert.assertEquals(1, dataSource.getNotEmptyWaitThreadPeak()); + Assert.assertEquals(10, dataSource.getNotEmptyWaitThreadCount()); + Assert.assertEquals(10, dataSource.getNotEmptyWaitThreadPeak()); conn.close(); @@ -84,6 +84,6 @@ public void run() { Thread.sleep(10); // Assert.assertEquals(0, dataSource.getNotEmptyWaitThreadCount()); - Assert.assertEquals(1, dataSource.getNotEmptyWaitThreadPeak()); + Assert.assertEquals(10, dataSource.getNotEmptyWaitThreadPeak()); } } diff --git a/core/src/test/java/com/alibaba/druid/bvt/pool/DruidDataSourceTest_notEmptyWait2.java b/core/src/test/java/com/alibaba/druid/bvt/pool/DruidDataSourceTest_notEmptyWait2.java index d1d93b1cd1..32480a3096 100644 --- a/core/src/test/java/com/alibaba/druid/bvt/pool/DruidDataSourceTest_notEmptyWait2.java +++ b/core/src/test/java/com/alibaba/druid/bvt/pool/DruidDataSourceTest_notEmptyWait2.java @@ -52,7 +52,7 @@ public void run() { System.out.println(Thread.currentThread() +" "+ LocalDateTime.now() + " getConnection== " + conn); conn.close(); } catch (Exception e) { - // e.printStackTrace(); + e.printStackTrace(); errorCount.incrementAndGet(); } finally { endLatch.countDown();