[jboss-cvs] JBoss Messaging SVN: r6709 - branches/Branch_1_4/src/main/org/jboss/jms/server/connectionmanager.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu May 7 14:46:16 EDT 2009


Author: jhowell at redhat.com
Date: 2009-05-07 14:46:16 -0400 (Thu, 07 May 2009)
New Revision: 6709

Modified:
   branches/Branch_1_4/src/main/org/jboss/jms/server/connectionmanager/SimpleConnectionManager.java
Log:
[JBMESSAGING-1620]  - Wrapped the connection object with a connection advised, right before the close.  

Modified: branches/Branch_1_4/src/main/org/jboss/jms/server/connectionmanager/SimpleConnectionManager.java
===================================================================
--- branches/Branch_1_4/src/main/org/jboss/jms/server/connectionmanager/SimpleConnectionManager.java	2009-05-07 17:15:53 UTC (rev 6708)
+++ branches/Branch_1_4/src/main/org/jboss/jms/server/connectionmanager/SimpleConnectionManager.java	2009-05-07 18:46:16 UTC (rev 6709)
@@ -31,10 +31,12 @@
 
 import javax.jms.JMSException;
 
+import org.jboss.aop.AspectManager;
 import org.jboss.jms.delegate.ConnectionEndpoint;
 import org.jboss.jms.server.ConnectionManager;
 import org.jboss.jms.server.endpoint.ServerConnectionEndpoint;
 import org.jboss.jms.server.endpoint.ServerConnectionFactoryEndpoint;
+import org.jboss.jms.server.endpoint.advised.ConnectionAdvised;
 import org.jboss.logging.Logger;
 import org.jboss.messaging.core.contract.ClusterNotification;
 import org.jboss.messaging.core.contract.ClusterNotificationListener;
@@ -353,7 +355,16 @@
                //Remoting is dumb and doesn't clean up it's state after itself - so we have to do it.
                ((ServerConnectionEndpoint)sce).closeCallbackClient();
             }
-            
+            // wrap the Endpoint in the ConnectionAdvised so that we get a proper call back for the close
+            // TODO:  What we really need to do is to wrap the End point in registerConnection, when we
+            // get the connection.  But, I'm hesitant, because there are are many of instanceof checks that would
+            // fail if I wrapped it during registerConneciton.
+            // Need to synchronized to prevent a deadlock
+            // See http://jira.jboss.com/jira/browse/JBMESSAGING-797
+            synchronized (AspectManager.instance())
+            {       
+               sce = new ConnectionAdvised(sce);
+            }
             try
             {
                sce.closing(-1);
@@ -435,13 +446,23 @@
             
             if (conn != null)
             {
-                // sce could also be a mock test.. so this test is required
+               
+               
+               // sce could also be a mock test.. so this test is required
                if (conn instanceof ServerConnectionEndpoint)
                {
                   //Remoting is dumb and doesn't clean up it's state after itself - so we have to do it.
                   ((ServerConnectionEndpoint)conn).closeCallbackClient();
                }
-               
+               // wrap the Endpoint in the ConnectionAdvised so that we get a proper call back for the close
+               // TODO:  What we really need to do is to wrap the Endpoint in registerConnection, when we
+               // get the connection.  Then anyone
+               // Need to synchronized to prevent a deadlock
+               // See http://jira.jboss.com/jira/browse/JBMESSAGING-797
+               synchronized (AspectManager.instance())
+               {       
+                  conn = new ConnectionAdvised(conn);
+               }
                try
                {
                   conn.closing(-1);




More information about the jboss-cvs-commits mailing list