activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [2/3] activemq-artemis git commit: ARTEMIS-231 fixing wrong notification exceptions
Date Fri, 25 Sep 2015 02:31:40 GMT
ARTEMIS-231 fixing wrong notification exceptions


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

Branch: refs/heads/master
Commit: fcdfbdb82e740be876c5672358e9f845b7e766f2
Parents: b0b5ca6
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Thu Sep 24 21:29:50 2015 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Thu Sep 24 22:31:28 2015 -0400

----------------------------------------------------------------------
 .../core/postoffice/impl/PostOfficeImpl.java    | 33 +++++++++++++-------
 1 file changed, 22 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fcdfbdb8/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
index 85ac2ef..8b2120d 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
@@ -251,7 +251,8 @@ public class PostOfficeImpl implements PostOffice, NotificationListener,
Binding
                SimpleString filterString = props.getSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING);
 
                if (!props.containsProperty(ManagementHelper.HDR_DISTANCE)) {
-                  throw ActiveMQMessageBundle.BUNDLE.distancenotSpecified();
+                  ActiveMQServerLogger.LOGGER.debug("PostOffice notification / BINDING_ADDED:
HDR_DISANCE not specified, giving up propagation on notifications");
+                  return;
                }
 
                int distance = props.getIntProperty(ManagementHelper.HDR_DISTANCE);
@@ -266,7 +267,8 @@ public class PostOfficeImpl implements PostOffice, NotificationListener,
Binding
                TypedProperties props = notification.getProperties();
 
                if (!props.containsProperty(ManagementHelper.HDR_CLUSTER_NAME)) {
-                  throw new IllegalStateException("No cluster name");
+                  ActiveMQServerLogger.LOGGER.debug("PostOffice notification / BINDING_REMOVED:
HDR_CLUSTER_NAME not specified, giving up propagation on notifications");
+                  return;
                }
 
                SimpleString clusterName = props.getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME);
@@ -274,7 +276,8 @@ public class PostOfficeImpl implements PostOffice, NotificationListener,
Binding
                QueueInfo info = queueInfos.remove(clusterName);
 
                if (info == null) {
-                  throw new IllegalStateException("Cannot find queue info for queue " + clusterName);
+                  ActiveMQServerLogger.LOGGER.debug("PostOffice notification / BINDING_REMOVED:
Cannot find queue info for queue \" + clusterName");
+                  return;
                }
 
                break;
@@ -283,7 +286,8 @@ public class PostOfficeImpl implements PostOffice, NotificationListener,
Binding
                TypedProperties props = notification.getProperties();
 
                if (!props.containsProperty(ManagementHelper.HDR_CLUSTER_NAME)) {
-                  throw new IllegalStateException("No cluster name");
+                  ActiveMQServerLogger.LOGGER.debug("PostOffice notification / CONSUMER_CREATED:
No clusterName defined");
+                  return;
                }
 
                SimpleString clusterName = props.getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME);
@@ -293,7 +297,8 @@ public class PostOfficeImpl implements PostOffice, NotificationListener,
Binding
                QueueInfo info = queueInfos.get(clusterName);
 
                if (info == null) {
-                  throw new IllegalStateException("Cannot find queue info for queue " + clusterName);
+                  ActiveMQServerLogger.LOGGER.debug("PostOffice notification / CONSUMER_CREATED:
Could not find queue created on clusterName = " + clusterName);
+                  return;
                }
 
                info.incrementConsumers();
@@ -311,7 +316,8 @@ public class PostOfficeImpl implements PostOffice, NotificationListener,
Binding
                }
 
                if (!props.containsProperty(ManagementHelper.HDR_DISTANCE)) {
-                  throw new IllegalStateException("No distance");
+                  ActiveMQServerLogger.LOGGER.debug("PostOffice notification / CONSUMER_CREATED:
No distance specified");
+                  return;
                }
 
                int distance = props.getIntProperty(ManagementHelper.HDR_DISTANCE);
@@ -320,7 +326,8 @@ public class PostOfficeImpl implements PostOffice, NotificationListener,
Binding
                   SimpleString queueName = props.getSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME);
 
                   if (queueName == null) {
-                     throw new IllegalStateException("No queue name");
+                     ActiveMQServerLogger.LOGGER.debug("PostOffice notification / CONSUMER_CREATED:
No queue defined");
+                     return;
                   }
 
                   Binding binding = getBinding(queueName);
@@ -347,7 +354,8 @@ public class PostOfficeImpl implements PostOffice, NotificationListener,
Binding
                SimpleString clusterName = props.getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME);
 
                if (clusterName == null) {
-                  throw new IllegalStateException("No cluster name");
+                  ActiveMQServerLogger.LOGGER.debug("PostOffice notification / CONSUMER_CLOSED:
No cluster name");
+                  return;
                }
 
                SimpleString filterString = props.getSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING);
@@ -368,7 +376,8 @@ public class PostOfficeImpl implements PostOffice, NotificationListener,
Binding
 
                if (info.getNumberOfConsumers() == 0) {
                   if (!props.containsProperty(ManagementHelper.HDR_DISTANCE)) {
-                     throw new IllegalStateException("No cluster name");
+                     ActiveMQServerLogger.LOGGER.debug("PostOffice notification / CONSUMER_CLOSED:
HDR_DISTANCE not defined");
+                     return;
                   }
 
                   int distance = props.getIntProperty(ManagementHelper.HDR_DISTANCE);
@@ -377,13 +386,15 @@ public class PostOfficeImpl implements PostOffice, NotificationListener,
Binding
                      SimpleString queueName = props.getSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME);
 
                      if (queueName == null) {
-                        throw new IllegalStateException("No queue name");
+                        ActiveMQServerLogger.LOGGER.debug("PostOffice notification / CONSUMER_CLOSED:
No queue name");
+                        return;
                      }
 
                      Binding binding = getBinding(queueName);
 
                      if (binding == null) {
-                        throw new IllegalStateException("No queue " + queueName);
+                        ActiveMQServerLogger.LOGGER.debug("PostOffice notification / CONSUMER_CLOSED:
Could not find queue " + queueName);
+                        return;
                      }
 
                      Queue queue = (Queue) binding.getBindable();


Mime
View raw message