[teiid-commits] teiid SVN: r548 - trunk/common-core/src/main/java/com/metamatrix/common/jdbc.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Mar 10 14:40:29 EDT 2009


Author: shawkins
Date: 2009-03-10 14:40:29 -0400 (Tue, 10 Mar 2009)
New Revision: 548

Modified:
   trunk/common-core/src/main/java/com/metamatrix/common/jdbc/SimplePooledConnectionSource.java
Log:
TEIID-412 fix for supporting pre-JDBC 4.0 drivers

Modified: trunk/common-core/src/main/java/com/metamatrix/common/jdbc/SimplePooledConnectionSource.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/jdbc/SimplePooledConnectionSource.java	2009-03-10 18:33:45 UTC (rev 547)
+++ trunk/common-core/src/main/java/com/metamatrix/common/jdbc/SimplePooledConnectionSource.java	2009-03-10 18:40:29 UTC (rev 548)
@@ -65,7 +65,7 @@
 		public Object invoke(Object proxy, Method method, Object[] args)
 				throws Throwable {
 			try {
-				if (method.getName().equals("close")) {
+				if (method.getName().equals("close")) { //$NON-NLS-1$
 					boolean isShutdown = shutdown;
 					if (!isShutdown) {
 						connections.add((Connection)proxy);
@@ -74,13 +74,19 @@
 					if (!isShutdown) {
 						return null;
 					}
-				} else if (method.getName().equals("isValid")) {
+				} else if (method.getName().equals("isValid")) { //$NON-NLS-1$
 					long now = System.currentTimeMillis();
 					if (lastTest + testInterval > now) {
 						return valid;
 					} 
 					lastTest = now;
-					valid = (Boolean)method.invoke(c, args);
+					try {
+						valid = c.isValid((Integer)args[0]);
+					} catch (AbstractMethodError e) {
+						valid = !c.isClosed();
+					} catch (SQLFeatureNotSupportedException e) {
+						valid = !c.isClosed();
+					}
 					return valid;
 				}
 				return method.invoke(c, args);
@@ -133,7 +139,7 @@
 			}
 			if (c == null) {
 				if (shutdown) {
-					throw new SQLException("pool shutdown");
+					throw new SQLException("pool shutdown"); //$NON-NLS-1$
 				}
 				try {
 					c = createConnection();




More information about the teiid-commits mailing list