[jboss-cvs] JBossAS SVN: r111799 - in branches/JBPAPP_5_1_1_GA_JBPAPP-6866: cluster/src/etc and 38 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jul 20 10:57:17 EDT 2011


Author: jbertram at redhat.com
Date: 2011-07-20 10:57:16 -0400 (Wed, 20 Jul 2011)
New Revision: 111799

Added:
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jdbc/ReentrantLock.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jms/ReentrantLock.java
Modified:
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/.gitignore
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/cluster/src/etc/hapartition-jboss-beans.xml
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/cluster/src/main/org/jboss/ha/framework/server/lock/AbstractClusterLockSupport.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/cluster/src/main/org/jboss/ha/framework/server/lock/ClusterLockState.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/cluster/src/main/org/jboss/ha/framework/server/lock/NonGloballyExclusiveClusterLockSupport.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/cluster/src/main/org/jboss/ha/framework/server/lock/YieldingGloballyExclusiveClusterLockSupport.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/build.xml
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jdbc/BaseWrapperManagedConnection.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jdbc/WrappedConnection.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jms/JmsManagedConnection.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jms/JmsSession.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/connectionmanager/xa/XAResourceWrapperImpl.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/connectionmanager/xa/XidWrapperImpl.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/main/src/bin/run.conf.bat
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/main/src/bin/run.sh
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/messaging/src/main/org/jboss/jms/server/destination/QueueMODefinition.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/bootstrap.xml
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/bootstrap/aop.xml
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/bootstrap/classloader.xml
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/bootstrap/deployers.xml
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/bootstrap/jmx.xml
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/bootstrap/logging.xml
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/bootstrap/vfs.xml
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/java.policy
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/jax-ws-catalog.xml
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/jboss-log4j.xml
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/jboss-service.xml
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/login-config.xml
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/props/
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/standardjboss.xml
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/standardjbosscmp-jdbc.xml
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/xmdesc/
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/xmdesc/NamingProviderURLWriter-xmbean.xml
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/minimal/bootstrap.xml
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/minimal/jboss-service.xml
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/deploy/legacy-invokers-service.xml
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/deployers/logbridge-jboss-beans.xml
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/main/org/jboss/deployment/FileNameVirtualFileFilter.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/system/src/main/org/jboss/system/server/profileservice/repository/AbstractBootstrapProfileFactory.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/system/src/resources/parsing-tests/common/profiles/clustering.profile
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/system/src/resources/parsing-tests/common/profiles/ejb3.profile
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/system/src/resources/parsing-tests/common/profiles/jboss-web.profile
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/system/src/resources/parsing-tests/config/profiles/default.profile
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/system/src/resources/parsing-tests/config/profiles/seam.profile
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/system/src/tests/org/jboss/test/server/profileservice/support/MavenProfileMetaData.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/bootstrapdependencies/jbas5349/ejb2/
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/bootstrapdependencies/jbas5349/ejb3/
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/bootstrapdependencies/jbas5349/sar/
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/bootstrapdependencies/jbas5349/servlet/
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/bootstrapdependencies/jbas5349/test/
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/classloader/leak/test/Ejb3ClassloaderLeakTestBase.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/classloader/leak/test/IsolatedEarWithDualCommonsLoggingClassloaderLeakTestCase.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/classloader/leak/test/J2EEClassloaderLeakTestBase.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/cluster/classloader/leak/test/FieldGranularityClassloaderLeakTestBase.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/cluster/classloader/leak/test/J2EEClassloaderLeakTestBase.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/YieldingGloballyExclusiveClusterLockSupportUnitTestCase.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/cluster/web/notification/SessionSpecListenerAttribute.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/ejb3/common/AbstractReplierMDB.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/ejb3/common/EJB3TestCase.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/ejb3/jbpapp2260/TransactionMDB.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/ejb3/jbpapp2260/unit/
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/spring/test/SpringFacadeTestCase.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/resources/bootstrapdependencies/jbas5349/
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/tools/buildmagic/lib/
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/varia/src/main/org/jboss/services/binding/ServiceBindingMetadata.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/varia/src/main/org/jboss/services/binding/managed/ServiceBindingMapper.java
   branches/JBPAPP_5_1_1_GA_JBPAPP-6866/varia/src/resources/seam/jboss-structure.xml
Log:
JBPAPP-6866


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/JBPAPP_5_1:111797


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/.gitignore
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/cluster/src/etc/hapartition-jboss-beans.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/cluster/src/main/org/jboss/ha/framework/server/lock/AbstractClusterLockSupport.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/cluster/src/main/org/jboss/ha/framework/server/lock/ClusterLockState.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/cluster/src/main/org/jboss/ha/framework/server/lock/NonGloballyExclusiveClusterLockSupport.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/cluster/src/main/org/jboss/ha/framework/server/lock/YieldingGloballyExclusiveClusterLockSupport.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Modified: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/build.xml
===================================================================
--- branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/build.xml	2011-07-20 14:29:39 UTC (rev 111798)
+++ branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/build.xml	2011-07-20 14:57:16 UTC (rev 111799)
@@ -354,9 +354,10 @@
         <include name="org/jboss/resource/adapter/jdbc/CachedPreparedStatement.class"/>
         <include name="org/jboss/resource/adapter/jdbc/PreparedStatementCache*.class"/>
         <include name="org/jboss/resource/adapter/jdbc/StatementAccess.class"/>
+        <include name="org/jboss/resource/adapter/jdbc/ReentrantLock.class"/>
         <include name="org/jboss/resource/adapter/jdbc/jdk5/*.class"/>
         <include name="org/jboss/resource/adapter/jdbc/jdk6/*.class"/>
-		<include name="org/jboss/resource/adapter/jdbc/URLSelectorStrategy.class"/>
+        <include name="org/jboss/resource/adapter/jdbc/URLSelectorStrategy.class"/>
         <include name="org/jboss/resource/adapter/jdbc/remote/*"/>
         <!-- JBAS-2250 hack -->
         <include name="org/jboss/ejb/plugins/cmp/jdbc/*" />

Modified: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jdbc/BaseWrapperManagedConnection.java
===================================================================
--- branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jdbc/BaseWrapperManagedConnection.java	2011-07-20 14:29:39 UTC (rev 111798)
+++ branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jdbc/BaseWrapperManagedConnection.java	2011-07-20 14:57:16 UTC (rev 111799)
@@ -36,7 +36,6 @@
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.locks.ReentrantLock;
 
 import javax.resource.ResourceException;
 import javax.resource.spi.ConnectionEvent;
@@ -214,6 +213,32 @@
 
    public void cleanup() throws ResourceException
    {
+      boolean isActive = false;
+
+      if (lock.hasQueuedThreads())
+      {
+         Collection<Thread> threads = lock.getQueuedThreads();
+         for (Thread thread : threads)
+         {
+            Throwable t = new Throwable("Thread waiting for lock during cleanup");
+            t.setStackTrace(thread.getStackTrace());
+
+            mcf.log.warn(t.getMessage(), t);
+         }
+
+         isActive = true;
+      }
+
+      if (lock.isLocked())
+      {
+         Throwable t = new Throwable("Lock owned during cleanup");
+         t.setStackTrace(lock.getOwner().getStackTrace());
+
+         mcf.log.warn(t.getMessage(), t);
+         
+         isActive = true;
+      }
+
       synchronized (handles)
       {
          for (Iterator i = handles.iterator(); i.hasNext();)
@@ -221,8 +246,10 @@
             WrappedConnection lc = (WrappedConnection) i.next();
             lc.setManagedConnection(null);
          }
+
          handles.clear();
       }
+
       //reset all the properties we know about to defaults.
       synchronized (stateLock)
       {
@@ -241,11 +268,14 @@
             }
          }
       }
-      // I'm recreating the lock object when we return to the pool
-      // because it looks too nasty to expect the connection handle
-      // to unlock properly in certain race conditions
-      // where the dissociation of the managed connection is "random".
-      lock = new ReentrantLock(true);
+
+      if (isActive)
+      {
+         // There are active lock - make sure that the JCA container kills
+         // this handle by throwing an exception
+
+         throw new ResourceException("Still active locks for " + this);
+      }
    }
 
    protected void lock()
@@ -275,8 +305,19 @@
    
    protected void unlock()
    {
-      if (lock.isHeldByCurrentThread())
+      if (lock.isLocked())
+      {
          lock.unlock();
+      }
+      else
+      {
+         mcf.log.warn("Owner is null");            
+         
+         Throwable t = new Throwable("Thread trying to unlock");
+         t.setStackTrace(Thread.currentThread().getStackTrace());
+
+         mcf.log.warn(t.getMessage(), t);
+      }
    }
 
    public Object getConnection(Subject subject, ConnectionRequestInfo cri) throws ResourceException
@@ -369,16 +410,19 @@
    {
       if(t instanceof SQLException)
       {
-         if(mcf.isStaleConnection((SQLException)t))
+         boolean stale = mcf.isStaleConnection((SQLException)t);
+
+         if(stale)
          {
             t = new StaleConnectionException((SQLException)t);           
          
          }else
          {
-            if(mcf.isExceptionFatal((SQLException)t))
+            boolean fatalException = mcf.isExceptionFatal((SQLException)t);
+
+            if(fatalException)
             {
                broadcastConnectionError(t);
-               
             }
          }
       }
@@ -404,6 +448,11 @@
          }
       }
 
+      // We need to unlock() before sending the connection error to the
+      // event listeners. Otherwise the lock won't be in sync once
+      // cleanup() is called
+      unlock();
+
       Exception ex = null;
       if (e instanceof Exception)
          ex = (Exception) e;

Copied: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jdbc/ReentrantLock.java (from rev 111797, branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/adapter/jdbc/ReentrantLock.java)
===================================================================
--- branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jdbc/ReentrantLock.java	                        (rev 0)
+++ branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jdbc/ReentrantLock.java	2011-07-20 14:57:16 UTC (rev 111799)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.resource.adapter.jdbc;
+
+import java.util.Collection;
+
+/**
+ * ReentrantLock override
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class ReentrantLock extends java.util.concurrent.locks.ReentrantLock
+{ 
+   /** Serial version uid */
+   private static final long serialVersionUID = 1L;
+
+   /**
+    * Constructor
+    * @param fair Fair locking
+    */
+   public ReentrantLock(boolean fair)
+   {
+      super(fair);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public Thread getOwner()
+   {
+      return super.getOwner();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public Collection<Thread> getQueuedThreads()
+   {
+      return super.getQueuedThreads();
+   }
+}

Modified: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jdbc/WrappedConnection.java
===================================================================
--- branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jdbc/WrappedConnection.java	2011-07-20 14:29:39 UTC (rev 111798)
+++ branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jdbc/WrappedConnection.java	2011-07-20 14:57:16 UTC (rev 111799)
@@ -63,16 +63,23 @@
    
    public WrappedConnection(final BaseWrapperManagedConnection mc)
    {
-      this.mc = mc;
-      if (mc != null)
-         trackStatements = mc.getTrackStatements();
+      setManagedConnection(mc);
    }
 
    void setManagedConnection(final BaseWrapperManagedConnection mc)
    {
       this.mc = mc;
+      this.lockCount = 0;
+
       if (mc != null)
+      {
          trackStatements = mc.getTrackStatements();
+      }
+      else
+      {
+         // Reset the lockedMC reference when returned to the pool
+         lockedMC = null;
+      }
    }
 
    protected void lock() throws SQLException
@@ -92,7 +99,7 @@
 
    protected void unlock()
    {
-      BaseWrapperManagedConnection mc = lockedMC;
+      BaseWrapperManagedConnection mc = this.lockedMC;
       if (--lockCount == 0)
          lockedMC = null;
 

Modified: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jms/JmsManagedConnection.java
===================================================================
--- branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jms/JmsManagedConnection.java	2011-07-20 14:29:39 UTC (rev 111798)
+++ branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jms/JmsManagedConnection.java	2011-07-20 14:57:16 UTC (rev 111799)
@@ -22,13 +22,13 @@
 package org.jboss.resource.adapter.jms;
 
 import java.io.PrintWriter;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 import java.util.Vector;
 import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.ReentrantLock;
 
 import javax.jms.Connection;
 import javax.jms.ExceptionListener;
@@ -355,11 +355,39 @@
       // destory handles
       destroyHandles();
 
-      // I'm recreating the lock object when we return to the pool
-      // because it looks too nasty to expect the connection handle
-      // to unlock properly in certain race conditions
-      // where the dissociation of the managed connection is "random".
-      lock = new ReentrantLock(true);
+      boolean isActive = false;
+
+      if (lock.hasQueuedThreads())
+      {
+         Collection<Thread> threads = lock.getQueuedThreads();
+         for (Thread thread : threads)
+         {
+            Throwable t = new Throwable("Thread waiting for lock during cleanup");
+            t.setStackTrace(thread.getStackTrace());
+
+            log.warn(t.getMessage(), t);
+         }
+
+         isActive = true;
+      }
+
+      if (lock.isLocked())
+      {
+         Throwable t = new Throwable("Lock owned during cleanup");
+         t.setStackTrace(lock.getOwner().getStackTrace());
+
+         log.warn(t.getMessage(), t);
+         
+         isActive = true;
+      }
+
+      if (isActive)
+      {
+         // There are active lock - make sure that the JCA container kills
+         // this handle by throwing an exception
+
+         throw new ResourceException("Still active locks for " + this);
+      }
    }
 
    /**
@@ -414,8 +442,19 @@
    
    protected void unlock()
    {
-      if (lock.isHeldByCurrentThread())
+      if (lock.isLocked())
+      {
          lock.unlock();
+      }
+      else
+      {
+         log.warn("Owner is null");            
+         
+         Throwable t = new Throwable("Thread trying to unlock");
+         t.setStackTrace(Thread.currentThread().getStackTrace());
+
+         log.warn(t.getMessage(), t);
+      }
    }
 
    /**
@@ -546,6 +585,12 @@
 
       log.warn("Handling jms exception failure: " + this, exception);
 
+      // We need to unlock() before sending the connection error to the
+      // event listeners. Otherwise the lock won't be in sync once
+      // cleanup() is called
+      if (lock.isLocked() && Thread.currentThread().equals(lock.getOwner()))
+         unlock();
+
       try
       {
          con.setExceptionListener(null);

Modified: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jms/JmsSession.java
===================================================================
--- branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jms/JmsSession.java	2011-07-20 14:29:39 UTC (rev 111798)
+++ branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jms/JmsSession.java	2011-07-20 14:57:16 UTC (rev 111799)
@@ -95,6 +95,8 @@
    public JmsSession(final JmsManagedConnection mc, JmsConnectionRequestInfo info)
    {
       this.mc = mc;
+      this.lockedMC = null;
+      this.lockCount = 0;
       this.info = info;
       if (trace)
          log.trace("new JmsSession " + this + " mc=" + mc + " cri=" + info);
@@ -123,7 +125,7 @@
 
    protected void unlock()
    {
-      JmsManagedConnection mc = this.mc;
+      JmsManagedConnection mc = this.lockedMC;
       if (--lockCount == 0)
          lockedMC = null;
 
@@ -746,6 +748,8 @@
    void destroy()
    {
       mc = null;
+      lockedMC = null;
+      lockCount = 0;
    }
 
    void start() throws JMSException

Copied: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jms/ReentrantLock.java (from rev 111797, branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/adapter/jms/ReentrantLock.java)
===================================================================
--- branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jms/ReentrantLock.java	                        (rev 0)
+++ branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/adapter/jms/ReentrantLock.java	2011-07-20 14:57:16 UTC (rev 111799)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.resource.adapter.jms;
+
+import java.util.Collection;
+
+/**
+ * ReentrantLock override
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class ReentrantLock extends java.util.concurrent.locks.ReentrantLock
+{ 
+   /** Serial version uid */
+   private static final long serialVersionUID = 1L;
+
+   /**
+    * Constructor
+    * @param fair Fair locking
+    */
+   public ReentrantLock(boolean fair)
+   {
+      super(fair);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public Thread getOwner()
+   {
+      return super.getOwner();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public Collection<Thread> getQueuedThreads()
+   {
+      return super.getQueuedThreads();
+   }
+}

Modified: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java
===================================================================
--- branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java	2011-07-20 14:29:39 UTC (rev 111798)
+++ branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java	2011-07-20 14:57:16 UTC (rev 111799)
@@ -367,7 +367,6 @@
       return result;
    }
 
-
    /**
     * Test if a connection can be obtained using default values
     * @return True if a connection was obtained; otherwise false


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/connectionmanager/xa/XAResourceWrapperImpl.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/connector/src/main/org/jboss/resource/connectionmanager/xa/XidWrapperImpl.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/main/src/bin/run.conf.bat
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/main/src/bin/run.sh
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/JBPAPP_4_2_0_GA_CP/system/src/bin/run.sh:108548
   + /branches/JBPAPP_4_2_0_GA_CP/system/src/bin/run.sh:108548
/branches/JBPAPP_5_1/main/src/bin/run.sh:111797


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/messaging/src/main/org/jboss/jms/server/destination/QueueMODefinition.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/bootstrap/aop.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/bootstrap/classloader.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/bootstrap/deployers.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/bootstrap/jmx.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/bootstrap/logging.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/bootstrap/vfs.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/bootstrap.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/java.policy
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/jax-ws-catalog.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/jboss-log4j.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/jboss-service.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/login-config.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/props
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/standardjboss.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/standardjbosscmp-jdbc.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/xmdesc
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/all/xmdesc/NamingProviderURLWriter-xmbean.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/minimal/bootstrap.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/conf/minimal/jboss-service.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/deploy/legacy-invokers-service.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/etc/deployers/logbridge-jboss-beans.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/server/src/main/org/jboss/deployment/FileNameVirtualFileFilter.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/system/src/main/org/jboss/system/server/profileservice/repository/AbstractBootstrapProfileFactory.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/system/src/resources/parsing-tests/common/profiles/clustering.profile
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/system/src/resources/parsing-tests/common/profiles/ejb3.profile
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/system/src/resources/parsing-tests/common/profiles/jboss-web.profile
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/system/src/resources/parsing-tests/config/profiles/default.profile
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/system/src/resources/parsing-tests/config/profiles/seam.profile
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/system/src/tests/org/jboss/test/server/profileservice/support/MavenProfileMetaData.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/bootstrapdependencies/jbas5349/ejb2
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/bootstrapdependencies/jbas5349/ejb3
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/bootstrapdependencies/jbas5349/sar
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/bootstrapdependencies/jbas5349/servlet
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/bootstrapdependencies/jbas5349/test
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/classloader/leak/test/Ejb3ClassloaderLeakTestBase.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/classloader/leak/test/IsolatedEarWithDualCommonsLoggingClassloaderLeakTestCase.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/classloader/leak/test/J2EEClassloaderLeakTestBase.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/cluster/classloader/leak/test/FieldGranularityClassloaderLeakTestBase.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/cluster/classloader/leak/test/J2EEClassloaderLeakTestBase.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/YieldingGloballyExclusiveClusterLockSupportUnitTestCase.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/cluster/web/notification/SessionSpecListenerAttribute.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/ejb3/common/AbstractReplierMDB.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/ejb3/common/EJB3TestCase.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/ejb3/jbpapp2260/TransactionMDB.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/ejb3/jbpapp2260/unit
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/main/org/jboss/test/spring/test/SpringFacadeTestCase.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/testsuite/src/resources/bootstrapdependencies/jbas5349
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/tools/buildmagic/lib
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/varia/src/main/org/jboss/services/binding/ServiceBindingMetadata.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/varia/src/main/org/jboss/services/binding/managed/ServiceBindingMapper.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 


Property changes on: branches/JBPAPP_5_1_1_GA_JBPAPP-6866/varia/src/resources/seam/jboss-structure.xml
___________________________________________________________________
Deleted: svn:mergeinfo
   - 



More information about the jboss-cvs-commits mailing list