You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2014/10/23 09:10:42 UTC

svn commit: r1633756 - /qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java

Author: rgodfrey
Date: Thu Oct 23 07:10:42 2014
New Revision: 1633756

URL: http://svn.apache.org/r1633756
Log:
QPID-6125 : temporary hack to deal with issue causing tests to fail when broker close occurs before message.release()

Modified:
    qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java?rev=1633756&r1=1633755&r2=1633756&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java Thu Oct 23 07:10:42 2014
@@ -403,7 +403,7 @@ public class AMQChannel
             {
                 _confirmedMessageCounter++;
             }
-
+            Runnable finallyAction = null;
             try
             {
 
@@ -471,7 +471,7 @@ public class AMQChannel
                                                                             );
                         if(enqueues == 0)
                         {
-                            handleUnroutableMessage(amqMessage);
+                            finallyAction = handleUnroutableMessage(amqMessage);
                         }
                         else
                         {
@@ -488,6 +488,10 @@ public class AMQChannel
                 finally
                 {
                     reference.release();
+                    if(finallyAction != null)
+                    {
+                        finallyAction.run();
+                    }
                 }
 
             }
@@ -510,12 +514,12 @@ public class AMQChannel
      * @throws AMQConnectionException if the message is mandatory close-on-no-route
      * @see AMQProtocolEngine#isCloseWhenNoRoute()
      */
-    private void handleUnroutableMessage(AMQMessage message)
+    private Runnable handleUnroutableMessage(AMQMessage message)
     {
         boolean mandatory = message.isMandatory();
         String description = currentMessageDescription();
         boolean closeOnNoRoute = _connection.isCloseWhenNoRoute();
-
+        Runnable returnVal = null;
         if(_logger.isDebugEnabled())
         {
             _logger.debug(String.format(
@@ -525,8 +529,16 @@ public class AMQChannel
 
         if (mandatory && isTransactional() && !_confirmOnPublish && _connection.isCloseWhenNoRoute())
         {
-            _connection.closeConnection(AMQConstant.NO_ROUTE,
-                    "No route for message " + currentMessageDescription(), _channelId);
+            returnVal = new Runnable()
+                        {
+                            @Override
+                            public void run()
+                            {
+                                _connection.closeConnection(AMQConstant.NO_ROUTE,
+                                        "No route for message " + currentMessageDescription(), _channelId);
+
+                            }
+                        };
         }
         else
         {
@@ -551,6 +563,7 @@ public class AMQChannel
                                                     routingKey == null ? null : routingKey.asString()));
             }
         }
+        return returnVal;
     }
 
     private String currentMessageDescription()



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org