[jboss-cvs] JBossAS SVN: r74779 - branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/connectionmanager.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jun 18 05:38:23 EDT 2008
Author: jesper.pedersen
Date: 2008-06-18 05:38:23 -0400 (Wed, 18 Jun 2008)
New Revision: 74779
Modified:
branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/connectionmanager/CachedConnectionManager.java
branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/connectionmanager/ConnectionFactoryBindingService.java
branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java
Log:
[JBPAPP-771] Race condition in XAResource start/end handling
Modified: branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/connectionmanager/CachedConnectionManager.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/connectionmanager/CachedConnectionManager.java 2008-06-18 09:01:12 UTC (rev 74778)
+++ branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/connectionmanager/CachedConnectionManager.java 2008-06-18 09:38:23 UTC (rev 74779)
@@ -544,13 +544,13 @@
try
{
Transaction tx = tm.getTransaction();
- if (TxUtils.isActive(tx))
+ if (tx != null)
{
TransactionSynchronizer.lock(tx);
try
{
CloseConnectionSynchronization cas = (CloseConnectionSynchronization) TransactionSynchronizer.getCCMSynchronization(tx);
- if (cas == null && createIfNotFound)
+ if (cas == null && createIfNotFound && TxUtils.isActive(tx))
{
cas = new CloseConnectionSynchronization();
TransactionSynchronizer.registerCCMSynchronization(tx, cas);
Modified: branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/connectionmanager/ConnectionFactoryBindingService.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/connectionmanager/ConnectionFactoryBindingService.java 2008-06-18 09:01:12 UTC (rev 74778)
+++ branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/connectionmanager/ConnectionFactoryBindingService.java 2008-06-18 09:38:23 UTC (rev 74779)
@@ -129,7 +129,7 @@
}
catch (ResourceException re)
{
- throw new DeploymentException("Could not create ConnectionFactory for adapter: " + cm);
+ throw new DeploymentException("Could not create ConnectionFactory for adapter: " + cm, re);
}
}
Modified: branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java 2008-06-18 09:01:12 UTC (rev 74778)
+++ branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java 2008-06-18 09:38:23 UTC (rev 74779)
@@ -312,17 +312,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)
@@ -337,12 +341,12 @@
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
@@ -366,7 +370,10 @@
else
{
cl.used();
- cls.add(cl);
+ if (cls.contains(cl) == false)
+ cls.add(cl);
+ else
+ log.warn("Attempt to return connection twice (ignored): " + cl, new Throwable("STACKTRACE"));
}
if (cl.hasPermit())
More information about the jboss-cvs-commits
mailing list