[jboss-cvs] JBossAS SVN: r59882 - in trunk/connector/src: resources/stylesheets and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Jan 20 16:06:21 EST 2007


Author: weston.price at jboss.com
Date: 2007-01-20 16:06:21 -0500 (Sat, 20 Jan 2007)
New Revision: 59882

Modified:
   trunk/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java
   trunk/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java
   trunk/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPoolMBean.java
   trunk/connector/src/resources/stylesheets/ConnectionFactoryTemplate.xsl
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: trunk/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java	2007-01-20 20:55:04 UTC (rev 59881)
+++ trunk/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java	2007-01-20 21:06:21 UTC (rev 59882)
@@ -236,6 +236,13 @@
                      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
@@ -795,6 +802,9 @@
 		public boolean prefill;
       
         public boolean stictMin;
+        
+        //Do we want to immeadiately break when a connection cannot be matched and not evaluate the rest of the pool?
+        public boolean useFastFail;
    }
 
    /**

Modified: trunk/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java	2007-01-20 20:55:04 UTC (rev 59881)
+++ trunk/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java	2007-01-20 21:06:21 UTC (rev 59882)
@@ -279,6 +279,15 @@
       
    }
    
+   public boolean getUseFastFail()
+   {
+      return this.poolParams.useFastFail;
+   }
+   
+   public void setUseFastFail(boolean useFastFail)
+   {
+      this.poolParams.useFastFail = useFastFail;
+   }
    public void flush()
    {
 	   if (poolingStrategy == null)

Modified: trunk/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPoolMBean.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPoolMBean.java	2007-01-20 20:55:04 UTC (rev 59881)
+++ trunk/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPoolMBean.java	2007-01-20 21:06:21 UTC (rev 59882)
@@ -260,5 +260,23 @@
     * @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);
+   
 }

Modified: trunk/connector/src/resources/stylesheets/ConnectionFactoryTemplate.xsl
===================================================================
--- trunk/connector/src/resources/stylesheets/ConnectionFactoryTemplate.xsl	2007-01-20 20:55:04 UTC (rev 59881)
+++ trunk/connector/src/resources/stylesheets/ConnectionFactoryTemplate.xsl	2007-01-20 21:06:21 UTC (rev 59882)
@@ -470,9 +470,7 @@
             <xsl:otherwise>
               <attribute name="StrictMin">False</attribute>
             </xsl:otherwise>
-          </xsl:choose>
-          
-          
+          </xsl:choose>          
           <xsl:choose>            
             <xsl:when test="statistics-formatter">
               <attribute name="StatisticsFormatter"><xsl:value-of select="statistics-formatter"/></attribute>
@@ -481,7 +479,14 @@
               <attribute name="StatisticsFormatter">org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</attribute>
             </xsl:otherwise>            
           </xsl:choose>
-          
+          <xsl:choose>
+            <xsl:when test="use-fast-fail">
+              <attribute name="UseFastFail"><xsl:value-of select="use-fast-fail"/></attribute>
+            </xsl:when>
+            <xsl:otherwise>
+              <attribute name="UseFastFail">False</attribute>
+            </xsl:otherwise>
+          </xsl:choose>
           <!--
 		criteria indicates if Subject (from security domain) or app supplied
             parameters (such as from getConnection(user, pw)) are used to distinguish




More information about the jboss-cvs-commits mailing list