Added validation query so bad connections will drop.
authorcantor <cantor@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 6 Nov 2003 17:05:01 +0000 (17:05 +0000)
committercantor <cantor@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 6 Nov 2003 17:05:01 +0000 (17:05 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@783 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/aa/attrresolv/provider/JDBCDataConnector.java

index ff0f5c2..dcacc59 100644 (file)
@@ -178,11 +178,12 @@ public class JDBCDataConnector extends BaseDataConnector implements DataConnecto
                if (maxIdle > 0) {
                        objectPool.setMaxIdle(maxIdle);
                }
-        if (maxWait > 0) {
-            objectPool.setMaxWait(1000*maxWait);
-        }
+               if (maxWait > 0) {
+                       objectPool.setMaxWait(1000*maxWait);
+               }
 
                objectPool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
+               objectPool.setTestOnBorrow(true);
 
                ConnectionFactory connFactory = null;
                PoolableConnectionFactory poolConnFactory = null;
@@ -202,9 +203,9 @@ public class JDBCDataConnector extends BaseDataConnector implements DataConnecto
                                connFactory,
                                objectPool,
                                new StackKeyedObjectPoolFactory(),
-                               null,
+                               "select 1",
                                false,
-                                       true);
+                               true);
                } catch (Exception ex) {
                        log.debug("Poolable connection factory error");
                }