[jboss-cvs] JBossAS SVN: r110630 - branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Feb 11 09:15:07 EST 2011


Author: jesper.pedersen
Date: 2011-02-11 09:15:07 -0500 (Fri, 11 Feb 2011)
New Revision: 110630

Modified:
   branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/ManagedConnectionFactoryDeployment.java
Log:
[JBPAPP-5292] Try isValid first when checking connection

Modified: branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/ManagedConnectionFactoryDeployment.java
===================================================================
--- branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/ManagedConnectionFactoryDeployment.java	2011-02-11 14:14:02 UTC (rev 110629)
+++ branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/ManagedConnectionFactoryDeployment.java	2011-02-11 14:15:07 UTC (rev 110630)
@@ -835,20 +835,31 @@
          }
          else
          {
+            Method method = null;
             try
             {
-               Method method = c.getClass().getMethod("close", new Class[0]);
+               method = c.getClass().getMethod("isValid", new Class[] {int.class});
                method.setAccessible(true);
-               method.invoke(c, new Object[0]);
+               Boolean b = (Boolean)method.invoke(c, new Object[] {new Integer(5)});
+               return !b.booleanValue();
             }
             catch (NoSuchMethodException nsme)
             {
-               log.warn("No close() method defined on connection interface. Destroying managed connection to clean-up", nsme);
-               return true;
+               try
+               {
+                  method = c.getClass().getMethod("close", (Class<?>)null);
+                  method.setAccessible(true);
+                  method.invoke(c, (Object)null);
+               }
+               catch (Throwable it)
+               {
+                  log.warn("No close() method defined on connection interface. Destroying managed connection to clean-up", it);
+                  return true;
+               }
             }
             catch (Throwable t)
             {
-               log.warn("Error during recovery connection close", t);
+               log.warn("Error during recovery connection isValid", t);
                return true;
             }
          }



More information about the jboss-cvs-commits mailing list