Pool should throw a SQL exception, never return null
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 25 Nov 2008 22:56:58 +0000 (22:56 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 25 Nov 2008 22:56:58 +0000 (22:56 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@720640 13f79535-47bb-0310-9956-ffa450edef68

modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java

index 91c4d91..fd89e0f 100644 (file)
@@ -418,8 +418,9 @@ public class ConnectionPool {
             } catch (InterruptedException ex) {
                 Thread.currentThread().interrupted();
             }
-            if (maxWait==0) { //no wait, return one if we have one
-                return con;
+            if (maxWait==0 && con == null) { //no wait, return one if we have one
+                throw new SQLException("[" + Thread.currentThread().getName()+"] " +
+                        "NoWait: Pool empty. Unable to fetch a connection, none available["+busy.size()+" in use].");
             }
             //we didn't get a connection, lets see if we timed out
             if (con == null) {