From 362743834a4e1a25a60268c2f8f715f4b5de3e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=A9=E5=B0=91?= Date: Wed, 6 Jun 2012 21:48:51 +0800 Subject: [PATCH] bug fixed for GetConnectionTimeoutException --- .../java/com/alibaba/druid/bvt/pool/TestConnectTimeout.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/java/com/alibaba/druid/bvt/pool/TestConnectTimeout.java b/src/test/java/com/alibaba/druid/bvt/pool/TestConnectTimeout.java index 95b6288478..b2255b6fd6 100644 --- a/src/test/java/com/alibaba/druid/bvt/pool/TestConnectTimeout.java +++ b/src/test/java/com/alibaba/druid/bvt/pool/TestConnectTimeout.java @@ -4,6 +4,7 @@ import java.sql.Connection; import java.util.ArrayList; import java.util.List; import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicLong; import junit.framework.Assert; import junit.framework.TestCase; @@ -44,6 +45,7 @@ public class TestConnectTimeout extends TestCase { connections.add(conn); } + final AtomicLong errorCount = new AtomicLong(); final int THREAD_COUNT = 10; final CountDownLatch latch = new CountDownLatch(THREAD_COUNT); for (int i = 0; i < THREAD_COUNT; ++i) { @@ -58,6 +60,7 @@ public class TestConnectTimeout extends TestCase { } } catch (Exception e) { e.printStackTrace(); + errorCount.incrementAndGet(); } finally { latch.countDown(); } @@ -67,6 +70,7 @@ public class TestConnectTimeout extends TestCase { } latch.await(); + Assert.assertEquals(0, errorCount.get()); } protected void tearDown() throws Exception {