tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fha...@apache.org
Subject svn commit: r708663 - in /tomcat/trunk/modules/jdbc-pool: doc/jdbc-pool.xml java/org/apache/tomcat/jdbc/pool/ConnectionPool.java test/org/apache/tomcat/jdbc/test/DefaultTestCase.java test/org/apache/tomcat/jdbc/test/TestTimeout.java
Date Tue, 28 Oct 2008 20:31:02 GMT
Author: fhanik
Date: Tue Oct 28 13:31:00 2008
New Revision: 708663

URL: http://svn.apache.org/viewvc?rev=708663&view=rev
Log:
Adjusted the timeout for abandoned, its in seconds

Modified:
    tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml
    tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
    tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/DefaultTestCase.java
    tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TestTimeout.java

Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml?rev=708663&r1=708662&r2=708663&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml (original)
+++ tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml Tue Oct 28 13:31:00 2008
@@ -257,6 +257,12 @@
       <p>(int) Property not used. The default value is <code>false</code>.</p>
     </attribute>
    
+    <attribute name="fairQueue" required="false">
+      <p>(boolean) Set to true if you wish that calls to getConnection should be treated
+         fairly in a true FIFO fashion. This uses the <code>org.apache.tomcat.jdbc.pool.FairBlockingQueue</code>

+         implementation for the list of the idle connections. The default value is <code>false</code>.
+      </p>
+    </attribute>
 
 
   </attributes>

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=708663&r1=708662&r2=708663&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 13:31:00 2008
@@ -514,7 +514,7 @@
             //if the connection pool is closed
             //close the connection instead of returning it
             release(con);
-            return;
+            return; 
         } //end if
 
         if (con != null) {
@@ -552,7 +552,7 @@
 
     public void checkAbandoned() {
         try {
-            long now = System.currentTimeMillis();
+            if (busy.size()==0) return;
             Iterator<PooledConnection> locked = busy.iterator();
             while (locked.hasNext()) {
                 PooledConnection con = locked.next();
@@ -564,6 +564,7 @@
                     if (idle.contains(con))
                         continue;
                     long time = con.getTimestamp();
+                    long now = System.currentTimeMillis();
                     if ((now - time) > con.getAbandonTimeout()) {
                         busy.remove(con);
                         abandon(con);
@@ -587,6 +588,7 @@
 
     public void checkIdle() {
         try {
+            if (idle.size()==0) return;
             long now = System.currentTimeMillis();
             Iterator<PooledConnection> unlocked = idle.iterator();
             while ( (idle.size()>=getPoolProperties().getMinIdle()) && unlocked.hasNext())
{
@@ -621,6 +623,7 @@
 
     public void testAllIdle() {
         try {
+            if (idle.size()==0) return;
             Iterator<PooledConnection> unlocked = idle.iterator();
             while (unlocked.hasNext()) {
                 PooledConnection con = unlocked.next();

Modified: tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/DefaultTestCase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/DefaultTestCase.java?rev=708663&r1=708662&r2=708663&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/DefaultTestCase.java (original)
+++ tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/DefaultTestCase.java Tue
Oct 28 13:31:00 2008
@@ -50,7 +50,7 @@
         p.setMaxActive(threadcount);
         p.setInitialSize(threadcount);
         p.setMaxWait(10000);
-        p.setRemoveAbandonedTimeout(10000);
+        p.setRemoveAbandonedTimeout(10);
         p.setMinEvictableIdleTimeMillis(10000);
         p.setMinIdle(threadcount);
         p.setLogAbandoned(false);

Modified: tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TestTimeout.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TestTimeout.java?rev=708663&r1=708662&r2=708663&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TestTimeout.java (original)
+++ tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TestTimeout.java Tue Oct
28 13:31:00 2008
@@ -39,7 +39,7 @@
             this.datasource.getPoolProperties().setTimeBetweenEvictionRunsMillis(1000);
             this.datasource.getPoolProperties().setMaxActive(20);
             this.datasource.getPoolProperties().setMaxWait(3000);
-            this.datasource.getPoolProperties().setRemoveAbandonedTimeout(5000);
+            this.datasource.getPoolProperties().setRemoveAbandonedTimeout(5);
             this.datasource.getPoolProperties().setMinEvictableIdleTimeMillis(5000);
             this.datasource.getPoolProperties().setMinIdle(5);
             this.datasource.getPoolProperties().setLogAbandoned(true);
@@ -69,7 +69,7 @@
             this.datasource.getPoolProperties().setTimeBetweenEvictionRunsMillis(1000);
             this.datasource.getPoolProperties().setMaxActive(20);
             this.datasource.getPoolProperties().setMaxWait(3000);
-            this.datasource.getPoolProperties().setRemoveAbandonedTimeout(5000);
+            this.datasource.getPoolProperties().setRemoveAbandonedTimeout(5);
             this.datasource.getPoolProperties().setMinEvictableIdleTimeMillis(5000);
             this.datasource.getPoolProperties().setMinIdle(5);
             this.datasource.getPoolProperties().setLogAbandoned(true);
@@ -99,7 +99,7 @@
             this.datasource.getPoolProperties().setTimeBetweenEvictionRunsMillis(1000);
             this.datasource.getPoolProperties().setMaxActive(20);
             this.datasource.getPoolProperties().setMaxWait(3000);
-            this.datasource.getPoolProperties().setRemoveAbandonedTimeout(5000);
+            this.datasource.getPoolProperties().setRemoveAbandonedTimeout(5);
             this.datasource.getPoolProperties().setMinEvictableIdleTimeMillis(5000);
             this.datasource.getPoolProperties().setMinIdle(5);
             this.datasource.getPoolProperties().setRemoveAbandoned(true);
@@ -130,7 +130,7 @@
             this.datasource.getPoolProperties().setTimeBetweenEvictionRunsMillis(1000);
             this.datasource.getPoolProperties().setMaxActive(20);
             this.datasource.getPoolProperties().setMaxWait(3000);
-            this.datasource.getPoolProperties().setRemoveAbandonedTimeout(5000);
+            this.datasource.getPoolProperties().setRemoveAbandonedTimeout(5);
             this.datasource.getPoolProperties().setMinEvictableIdleTimeMillis(5000);
             this.datasource.getPoolProperties().setMinIdle(5);
             this.datasource.getPoolProperties().setRemoveAbandoned(true);



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


Mime
View raw message