tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fha...@apache.org
Subject svn commit: r708592 - in /tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool: ConnectionPool.java DataSourceFactory.java DataSourceProxy.java PoolProperties.java
Date Tue, 28 Oct 2008 15:00:22 GMT
Author: fhanik
Date: Tue Oct 28 08:00:22 2008
New Revision: 708592

URL: http://svn.apache.org/viewvc?rev=708592&view=rev
Log:
Make the polling fairness configurable

Modified:
    tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
    tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java
    tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java
    tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java

Modified: tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=708592&r1=708591&r2=708592&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original)
+++ tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Tue
Oct 28 08:00:22 2008
@@ -265,7 +265,7 @@
         //make space for 10 extra in case we flow over a bit
         busy = new ArrayBlockingQueue<PooledConnection>(properties.getMaxActive(),false);
         //make space for 10 extra in case we flow over a bit
-        idle = new ArrayBlockingQueue<PooledConnection>(properties.getMaxActive(),false);
+        idle = new ArrayBlockingQueue<PooledConnection>(properties.getMaxActive(),properties.isFairQueue());
 
         //if the evictor thread is supposed to run, start it now
         if (properties.isPoolSweeperEnabled()) {

Modified: tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java?rev=708592&r1=708591&r2=708592&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java
(original)
+++ tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java
Tue Oct 28 08:00:22 2008
@@ -99,6 +99,7 @@
     protected final static String PROP_INTERCEPTORS = "jdbcInterceptors";
     protected final static String PROP_VALIDATIONINTERVAL = "validationInterval";
     protected final static String PROP_JMX_ENABLED = "jmxEnabled";
+    protected final static String PROP_FAIR_QUEUE = "fairQueue";
     
     public static final int UNKNOWN_TRANSACTIONISOLATION = -1;
 
@@ -135,7 +136,8 @@
         PROP_CONNECTIONPROPERTIES,
         PROP_INITSQL,
         PROP_INTERCEPTORS,
-        PROP_JMX_ENABLED
+        PROP_JMX_ENABLED,
+        PROP_FAIR_QUEUE
     };
 
     // -------------------------------------------------- ObjectFactory Methods
@@ -380,6 +382,12 @@
         if (value != null) {
             dataSource.getPoolProperties().setJmxEnabled(Boolean.parseBoolean(value));
         }
+        
+        value = properties.getProperty(PROP_FAIR_QUEUE);
+        if (value != null) {
+            dataSource.getPoolProperties().setFairQueue(Boolean.parseBoolean(value));
+        }
+        
 
         // Return the configured DataSource instance
         DataSource ds = getDataSource(dataSource);

Modified: tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java?rev=708592&r1=708591&r2=708592&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java (original)
+++ tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java Tue
Oct 28 08:00:22 2008
@@ -284,6 +284,10 @@
         this.getPoolProperties().setJmxEnabled(enabled);
     }
     
+    public void setFairQueue(boolean fairQueue) {
+        this.getPoolProperties().setFairQueue(fairQueue);
+    }
+    
     public void setConnectionProperties(String properties) {
         try {
             java.util.Properties prop = DataSourceFactory.getProperties(properties);

Modified: tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java?rev=708592&r1=708591&r2=708592&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java (original)
+++ tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java Tue
Oct 28 08:00:22 2008
@@ -58,6 +58,15 @@
     protected String initSQL;
     protected boolean testOnConnect =false;
     private String jdbcInterceptors=null;
+    private boolean fairQueue = false;
+
+    public boolean isFairQueue() {
+        return fairQueue;
+    }
+
+    public void setFairQueue(boolean fairQueue) {
+        this.fairQueue = fairQueue;
+    }
 
     public boolean isAccessToUnderlyingConnectionAllowed() {
         return accessToUnderlyingConnectionAllowed;



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message