cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From johnth...@apache.org
Subject cayenne git commit: Restore behavior so ConnectionUnavailableException is thrown if obtaining a DB connection from the pool times out
Date Wed, 24 Jun 2015 16:39:19 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master faa48a481 -> 34bdd84dc


Restore behavior so ConnectionUnavailableException is thrown if obtaining a DB connection
from the pool times out


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/34bdd84d
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/34bdd84d
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/34bdd84d

Branch: refs/heads/master
Commit: 34bdd84dca4b0dd89a53f2bf582dca7bd11b2e0c
Parents: faa48a4
Author: John Huss <johnthuss@apache.org>
Authored: Wed Jun 24 11:38:05 2015 -0500
Committer: John Huss <johnthuss@apache.org>
Committed: Wed Jun 24 11:38:27 2015 -0500

----------------------------------------------------------------------
 .../datasource/UnmanagedPoolingDataSource.java        | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/34bdd84d/cayenne-server/src/main/java/org/apache/cayenne/datasource/UnmanagedPoolingDataSource.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/datasource/UnmanagedPoolingDataSource.java
b/cayenne-server/src/main/java/org/apache/cayenne/datasource/UnmanagedPoolingDataSource.java
index e822589..a054807 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/datasource/UnmanagedPoolingDataSource.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/datasource/UnmanagedPoolingDataSource.java
@@ -70,6 +70,18 @@ public class UnmanagedPoolingDataSource implements PoolingDataSource {
 		}
 	}
 
+    /**
+     * An exception indicating that a connection request waiting in the queue
+     * timed out and was unable to obtain a connection.
+     */
+    public static class ConnectionUnavailableException extends SQLException {
+        private static final long serialVersionUID = 1063973806941023165L;
+
+        public ConnectionUnavailableException(String message) {
+    		super(message);
+    	}
+    }
+    
 	/**
 	 * Defines a maximum time in milliseconds that a connection request could
 	 * wait in the connection queue. After this period expires, an exception
@@ -323,7 +335,7 @@ public class UnmanagedPoolingDataSource implements PoolingDataSource {
 			return resetState(c);
 		}
 
-		throw new SQLException("Can't obtain connection. Request to pool timed out. Total pool
size: " + pool.size());
+		throw new ConnectionUnavailableException("Can't obtain connection. Request to pool timed
out. Total pool size: " + pool.size());
 	}
 
 	@Override


Mime
View raw message