[jboss-cvs] JBossAS SVN: r68462 - trunk/connector/src/main/org/jboss/resource/connectionmanager.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Dec 20 12:09:59 EST 2007
Author: adrian at jboss.org
Date: 2007-12-20 12:09:59 -0500 (Thu, 20 Dec 2007)
New Revision: 68462
Modified:
trunk/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java
Log:
[JBAS-5095] - Port IMCP duplicate check from 4.2.
Modified: trunk/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java 2007-12-20 17:03:49 UTC (rev 68461)
+++ trunk/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java 2007-12-20 17:09:59 UTC (rev 68462)
@@ -303,17 +303,21 @@
public void returnConnection(ConnectionListener cl, boolean kill)
{
- if (cl.getState() == ConnectionListener.DESTROYED)
+ synchronized (cls)
{
- log.trace("ManagedConnection is being returned after it was destroyed" + cl);
- if (cl.hasPermit())
+ if (cl.getState() == ConnectionListener.DESTROYED)
{
- // release semaphore
- cl.grantPermit(false);
- permits.release();
+ if (trace)
+ log.trace("ManagedConnection is being returned after it was destroyed" + cl);
+ if (cl.hasPermit())
+ {
+ // release semaphore
+ cl.grantPermit(false);
+ permits.release();
+ }
+
+ return;
}
-
- return;
}
if (trace)
@@ -328,12 +332,11 @@
kill = true;
}
- // We need to destroy this one
- if (cl.getState() == ConnectionListener.DESTROY)
- kill = true;
-
synchronized (cls)
{
+ // We need to destroy this one
+ if (cl.getState() == ConnectionListener.DESTROY || cl.getState() == ConnectionListener.DESTROYED)
+ kill = true;
checkedOut.remove(cl);
// This is really an error
@@ -350,14 +353,15 @@
// a connection error occurred.
// This could happen while the connection is not checked out.
// e.g. JMS can do this via an ExceptionListener on the connection.
- // I have twice had to reinstate this line of code, PLEASE DO NOT REMOTE IT!
+ // I have twice had to reinstate this line of code, PLEASE DO NOT REMOVE IT!
cls.remove(cl);
}
// return to the pool
else
{
cl.used();
- cls.add(cl);
+ if (cls.contains(cl) == false)
+ cls.add(cl);
}
if (cl.hasPermit())
@@ -875,4 +879,4 @@
}
}
-}
\ No newline at end of file
+}
More information about the jboss-cvs-commits
mailing list