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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Jan 20 15:54:17 EST 2007


Author: weston.price at jboss.com
Date: 2007-01-20 15:54:17 -0500 (Sat, 20 Jan 2007)
New Revision: 59880

Modified:
   branches/Branch_4_2/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java
   branches/Branch_4_2/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java
   branches/Branch_4_2/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPoolMBean.java
Log:
[JBAS-3851] Added fast fail property to allow connection attempt
to fail at first attempt rather than evaluate the entire pool. 
This is performance optimization and can be addressed by other means
though this is the most 'direct' route. 

Modified: branches/Branch_4_2/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java
===================================================================
--- branches/Branch_4_2/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java	2007-01-20 16:09:47 UTC (rev 59879)
+++ branches/Branch_4_2/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java	2007-01-20 20:54:17 UTC (rev 59880)
@@ -237,6 +237,7 @@
                      }
                      doDestroy(cl);
                      cl = null;
+                                        
                   }
                   catch (Throwable t)
                   {
@@ -247,7 +248,16 @@
                      }
                      doDestroy(cl);
                      cl = null;
+                  
+                    
                   }
+                  //We made it here, something went wrong and we should validate if we should continue attempting to acquire a connection
+                  if(poolParams.useFastFail)
+                  {
+                     log.trace("Fast failing for connection attempt. No more attempts will be made to acquire connection from pool and a new connection will be created immeadiately");
+                     break;
+                  }
+               
                }
             }
             while (cls.size() > 0);//end of do loop
@@ -773,6 +783,8 @@
       
       public boolean prefill;
       
+      //Do we want to immeadiately break when a connection cannot be matched and not evaluate the rest of the pool?
+      public boolean useFastFail;
    }
 
    /**

Modified: branches/Branch_4_2/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java
===================================================================
--- branches/Branch_4_2/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java	2007-01-20 16:09:47 UTC (rev 59879)
+++ branches/Branch_4_2/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java	2007-01-20 20:54:17 UTC (rev 59880)
@@ -234,8 +234,17 @@
    public void setPreFill(boolean prefill)
    {
       this.poolParams.prefill = prefill;
-
    }
+   
+   public boolean getUseFastFail()
+   {
+      return this.poolParams.useFastFail;
+   }
+   
+   public void setUseFastFail(boolean useFastFail)
+   {
+      this.poolParams.useFastFail = useFastFail;
+   }
 
    public void flush()
    {

Modified: branches/Branch_4_2/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPoolMBean.java
===================================================================
--- branches/Branch_4_2/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPoolMBean.java	2007-01-20 16:09:47 UTC (rev 59879)
+++ branches/Branch_4_2/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPoolMBean.java	2007-01-20 20:54:17 UTC (rev 59880)
@@ -214,5 +214,24 @@
     * @param poolName the jndi name of the pool.
     */
    public void setPoolJndiName(String poolName);
+ 
+   /**
+    * Whether or not we want to immeadiately create a new connection when 
+    * an attempt to acquire a connection from the pool fails.
+    * 
+    * @return true of false depending upon whether fast fail is being used.
+    * 
+    */
+   public boolean getUseFastFail();
    
+   /**
+    * Indicate whether or not we want to immeadiately create a new connection when 
+    * an attempt to acquire a connection from the pool fails.
+    * 
+    * 
+    * @param useFastFail whether or not we want to use fast fail semantics in a connection attempt.
+    */
+   public void setUseFastFail(boolean useFastFail);
+   
+   
 }




More information about the jboss-cvs-commits mailing list