[prev in list] [next in list] [prev in thread] [next in thread] 

List:       activemq-commits
Subject:    [1/2] activemq-artemis git commit: ARTEMIS-1707 Check for already exists exceptions and ignore
From:       clebertsuconic () apache ! org
Date:       2018-02-27 23:52:23
Message-ID: 2a9378aeffb14ddca954c6b842ade701 () git ! apache ! org
[Download RAW message or body]

Repository: activemq-artemis
Updated Branches:
  refs/heads/master d80e469a6 -> af7f74e59


ARTEMIS-1707 Check for already exists exceptions and ignore

For address and queue create check for the already exists exceptions and
ignore as another client might have just created the same

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

Branch: refs/heads/master
Commit: 38fb17703b3479d1ef933b8f5a99e75f72166c96
Parents: d80e469
Author: Timothy Bish <tabish121@gmail.com>
Authored: Tue Feb 27 16:30:06 2018 -0500
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Tue Feb 27 16:30:45 2018 -0500

----------------------------------------------------------------------
 .../protocol/openwire/OpenWireConnection.java   | 33 +++++++++++++-------
 1 file changed, 22 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/38fb1770/artemis-protocol \
s/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
                
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java \
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
 index 8e9146a..02e3b58 100644
--- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
                
+++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
 @@ -16,13 +16,6 @@
  */
 package org.apache.activemq.artemis.core.protocol.openwire;
 
-import javax.jms.IllegalStateException;
-import javax.jms.InvalidClientIDException;
-import javax.jms.InvalidDestinationException;
-import javax.jms.JMSSecurityException;
-import javax.transaction.xa.XAException;
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.Xid;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
@@ -35,10 +28,20 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicLongFieldUpdater;
 
+import javax.jms.IllegalStateException;
+import javax.jms.InvalidClientIDException;
+import javax.jms.InvalidDestinationException;
+import javax.jms.JMSSecurityException;
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
 import org.apache.activemq.advisory.AdvisorySupport;
+import org.apache.activemq.artemis.api.core.ActiveMQAddressExistsException;
 import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
 import org.apache.activemq.artemis.api.core.ActiveMQException;
 import org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException;
+import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException;
 import org.apache.activemq.artemis.api.core.ActiveMQRemoteDisconnectException;
 import org.apache.activemq.artemis.api.core.ActiveMQSecurityException;
 import org.apache.activemq.artemis.api.core.RoutingType;
@@ -765,11 +768,19 @@ public class OpenWireConnection extends \
AbstractRemotingConnection implements Se  addressInfo.setInternal(true);
          }
          if (dest.isQueue() && (addressSettings.isAutoCreateQueues() || \
                dest.isTemporary())) {
-            internalSession.createQueue(addressInfo, qName, null, \
                dest.isTemporary(), !dest.isTemporary(), !dest.isTemporary());
-            created = true;
+            try {
+               internalSession.createQueue(addressInfo, qName, null, \
dest.isTemporary(), !dest.isTemporary(), !dest.isTemporary()); +               \
created = true; +            } catch (ActiveMQQueueExistsException exists) {
+               // The queue may have been created by another thread in the mean \
time.  Catch and do nothing. +            }
          } else if (dest.isTopic() && (addressSettings.isAutoCreateAddresses() || \
                dest.isTemporary())) {
-            internalSession.createAddress(addressInfo, !dest.isTemporary());
-            created = true;
+            try {
+               internalSession.createAddress(addressInfo, !dest.isTemporary());
+               created = true;
+            } catch (ActiveMQAddressExistsException exists) {
+               // The address may have been created by another thread in the mean \
time.  Catch and do nothing. +            }
          }
       }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic