Author: fhanik
Date: Wed Mar 2 21:15:07 2011
New Revision: 1076380
URL: http://svn.apache.org/viewvc?rev=1076380&view=rev
Log:
https://issues.apache.org/bugzilla/show_bug.cgi?id=50857
Timeouts have to be trapped, and properly handled
Modified:
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
Modified:
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1076380&r1=1076379&r2=1076380&view=diff
==============================================================================
---
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
(original)
+++
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
Wed Mar 2 21:15:07 2011
@@ -140,11 +140,16 @@ public class ConnectionPool {
* @throws SQLException
*/
public Future<Connection> getConnectionAsync() throws SQLException {
- PooledConnection pc = this.borrowConnection(0, null, null);
- if (pc!=null) {
-
- return new ConnectionFuture(pc);
- }
+ try {
+ PooledConnection pc = borrowConnection(0, null, null);
+ if (pc!=null) {
+ return new ConnectionFuture(pc);
+ }
+ }catch (SQLException x) {
+ if (x.getMessage().indexOf("NoWait")<0) {
+ throw x;
+ }
+ }
//we can only retrieve a future if the underlying queue supports it.
if (idle instanceof FairBlockingQueue<?>) {
Future<PooledConnection> pcf =
((FairBlockingQueue<PooledConnection>)idle).pollAsync();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]