[jboss-cvs] JBossAS SVN: r71781 - 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
Tue Apr 8 05:30:09 EDT 2008
Author: adrian at jboss.org
Date: 2008-04-08 05:30:09 -0400 (Tue, 08 Apr 2008)
New Revision: 71781
Modified:
branches/Branch_4_2/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java
Log:
Fix bug and race condition in max wait time and source code tidyup
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 2008-04-08 09:09:50 UTC (rev 71780)
+++ branches/Branch_4_2/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java 2008-04-08 09:30:09 UTC (rev 71781)
@@ -180,10 +180,8 @@
{
if (permits.attempt(poolParams.blockingTimeout))
{
- long poolBlockTime = System.currentTimeMillis() - startWait ;
- connectionCounter.updateBlockTime(poolBlockTime);
- if(connectionCounter.getMaxWaitTime() < poolBlockTime)
- connectionCounter.setMaxWaitTime(poolBlockTime);
+ long poolBlockTime = System.currentTimeMillis() - startWait ;
+ connectionCounter.updateBlockTime(poolBlockTime);
//We have a permit to get a connection. Is there one in the pool already?
ConnectionListener cl = null;
do
@@ -567,7 +565,7 @@
public long getTotalBlockTime()
{
- return connectionCounter.getTotalBlockTime();
+ return connectionCounter.getTotalBlockTime();
}
public int getTimedOut()
@@ -834,8 +832,8 @@
// Idle timed out Connection Count.
private int timedOut;
-
-
+
+ // The maximum wait time */
private long maxWaitTime;
synchronized int getGuaranteedCount()
@@ -870,37 +868,29 @@
synchronized void updateBlockTime(long latest)
{
- totalBlockTime += latest;
+ totalBlockTime += latest;
+ if (maxWaitTime < latest)
+ maxWaitTime = latest;
}
- long getTotalBlockTime(){
-
- return totalBlockTime;
-
+ long getTotalBlockTime()
+ {
+ return totalBlockTime;
}
- int getTimedOut(){
-
- return timedOut;
-
+ int getTimedOut()
+ {
+ return timedOut;
}
-
- synchronized void incTimedOut(){
-
- ++timedOut;
-
+
+ synchronized void incTimedOut()
+ {
+ ++timedOut;
}
- long getMaxWaitTime(){
-
+ long getMaxWaitTime()
+ {
return maxWaitTime;
-
}
-
- synchronized void setMaxWaitTime(long maxWaitTime){
-
- this.maxWaitTime = timedOut;
-
- }
}
-}
\ No newline at end of file
+}
More information about the jboss-cvs-commits
mailing list