[jboss-cvs] JBossAS SVN: r60493 - trunk/jbossmq/src/main/org/jboss/mq.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Feb 12 11:29:53 EST 2007


Author: adrian at jboss.org
Date: 2007-02-12 11:29:53 -0500 (Mon, 12 Feb 2007)
New Revision: 60493

Modified:
   trunk/jbossmq/src/main/org/jboss/mq/Connection.java
Log:
[JBAS-4090] - Deadlock in ping task

Modified: trunk/jbossmq/src/main/org/jboss/mq/Connection.java
===================================================================
--- trunk/jbossmq/src/main/org/jboss/mq/Connection.java	2007-02-12 15:22:57 UTC (rev 60492)
+++ trunk/jbossmq/src/main/org/jboss/mq/Connection.java	2007-02-12 16:29:53 UTC (rev 60493)
@@ -1282,14 +1282,20 @@
 	 */
    class PingTask implements Runnable
    {
-      /**
-		 * Main processing method for the PingTask object
-		 */
       public void run()
       {
+         // Don't bother if we are closing
+         if (closing.get())
+            return;
+         
          try
          {
-            pingTaskSemaphore.acquire();
+            // If we can't aquire the semaphore then it
+            // almost certainly means the close has got it
+            // Try for 10 seconds to make sure the problem
+            // is not just a long garbage collection that has suspended threads
+            if (pingTaskSemaphore.attempt(1000 * 10) == false)
+               return;
          }
          catch (InterruptedException e)
          {




More information about the jboss-cvs-commits mailing list