You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2018/09/06 22:06:39 UTC

[1/2] activemq-artemis git commit: ARTEMIS-2072 refactor logic to fix tests

Repository: activemq-artemis
Updated Branches:
  refs/heads/master 05ce7c6ec -> 0adee3c33


ARTEMIS-2072 refactor logic to fix tests


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/24fa0f92
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/24fa0f92
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/24fa0f92

Branch: refs/heads/master
Commit: 24fa0f920347f49270d1630b86b8b01987e66b92
Parents: 05ce7c6
Author: Justin Bertram <jb...@apache.org>
Authored: Thu Sep 6 12:52:25 2018 -0500
Committer: Justin Bertram <jb...@apache.org>
Committed: Thu Sep 6 12:53:57 2018 -0500

----------------------------------------------------------------------
 .../amqp/broker/AMQPSessionCallback.java        | 49 +++++++++++---------
 1 file changed, 28 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/24fa0f92/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java
index b32a4c7..6b163ae 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java
@@ -45,6 +45,7 @@ import org.apache.activemq.artemis.core.server.ServerProducer;
 import org.apache.activemq.artemis.core.server.ServerSession;
 import org.apache.activemq.artemis.core.server.impl.AddressInfo;
 import org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl;
+import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.core.transaction.Transaction;
 import org.apache.activemq.artemis.protocol.amqp.exceptions.ActiveMQAMQPException;
 import org.apache.activemq.artemis.protocol.amqp.exceptions.ActiveMQAMQPInternalErrorException;
@@ -306,33 +307,39 @@ public class AMQPSessionCallback implements SessionCallback {
 
 
    public boolean checkAddressAndAutocreateIfPossible(SimpleString address, RoutingType routingType) throws Exception {
-      AddressInfo addressInfo = manager.getServer().getAddressInfo(address);
-
-      // if the address exists go ahead and return
-      if (addressInfo != null) {
-         return true;
-      }
-
-      // if the address and/or queue don't exist then create them if possible
-      if (routingType == RoutingType.MULTICAST && addressInfo == null) {
-         if (manager.getServer().getAddressSettingsRepository().getMatch(address.toString()).isAutoCreateAddresses()) {
-            try {
-               serverSession.createAddress(address, routingType, true);
-            } catch (ActiveMQAddressExistsException e) {
-               // The address may have been created by another thread in the mean time.  Catch and do nothing.
+      boolean result = false;
+      SimpleString unPrefixedAddress = serverSession.removePrefix(address);
+      AddressSettings addressSettings = manager.getServer().getAddressSettingsRepository().getMatch(unPrefixedAddress.toString());
+
+      if (routingType == RoutingType.MULTICAST) {
+         if (manager.getServer().getAddressInfo(unPrefixedAddress) == null) {
+            if (addressSettings.isAutoCreateAddresses()) {
+               try {
+                  serverSession.createAddress(address, routingType, true);
+               } catch (ActiveMQAddressExistsException e) {
+                  // The address may have been created by another thread in the mean time.  Catch and do nothing.
+               }
+               result = true;
             }
+         } else {
+            result = true;
          }
-      } else if (routingType == RoutingType.ANYCAST && manager.getServer().locateQueue(address) == null) {
-         if (manager.getServer().getAddressSettingsRepository().getMatch(address.toString()).isAutoCreateQueues()) {
-            try {
-               serverSession.createQueue(address, address, routingType, null, false, true, true);
-            } catch (ActiveMQQueueExistsException e) {
-               // The queue may have been created by another thread in the mean time.  Catch and do nothing.
+      } else if (routingType == RoutingType.ANYCAST) {
+         if (manager.getServer().locateQueue(unPrefixedAddress) == null) {
+            if (addressSettings.isAutoCreateQueues()) {
+               try {
+                  serverSession.createQueue(address, address, routingType, null, false, true, true);
+               } catch (ActiveMQQueueExistsException e) {
+                  // The queue may have been created by another thread in the mean time.  Catch and do nothing.
+               }
+               result = true;
             }
+         } else {
+            result = true;
          }
       }
 
-      return manager.getServer().getAddressInfo(address) != null;
+      return result;
    }
 
 


[2/2] activemq-artemis git commit: This closes #2297

Posted by cl...@apache.org.
This closes #2297


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/0adee3c3
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/0adee3c3
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/0adee3c3

Branch: refs/heads/master
Commit: 0adee3c33f029d7e4ae4f39c910b32a7b0b03a70
Parents: 05ce7c6 24fa0f9
Author: Clebert Suconic <cl...@apache.org>
Authored: Thu Sep 6 18:06:33 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Sep 6 18:06:33 2018 -0400

----------------------------------------------------------------------
 .../amqp/broker/AMQPSessionCallback.java        | 49 +++++++++++---------
 1 file changed, 28 insertions(+), 21 deletions(-)
----------------------------------------------------------------------