activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject activemq git commit: AMQ-6183 Add isDispatchSync to the subscription view and deprecate the meaningless one in the producer view
Date Wed, 24 Feb 2016 22:25:36 GMT
Repository: activemq
Updated Branches:
  refs/heads/master bc960f3a7 -> c2ad0c325


AMQ-6183 Add isDispatchSync to the subscription view and deprecate the
meaningless one in the producer view

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

Branch: refs/heads/master
Commit: c2ad0c32512e5265fa5482a0e49aa13f359acb8f
Parents: bc960f3
Author: Timothy Bish <tabish121@gmail.com>
Authored: Wed Feb 24 17:25:01 2016 -0500
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Wed Feb 24 17:25:01 2016 -0500

----------------------------------------------------------------------
 .../activemq/broker/jmx/ProducerView.java       |  5 +-
 .../activemq/broker/jmx/ProducerViewMBean.java  |  2 +
 .../activemq/broker/jmx/SubscriptionView.java   |  9 ++++
 .../broker/jmx/SubscriptionViewMBean.java       |  6 +++
 .../apache/activemq/broker/jmx/MBeanTest.java   | 49 +++++++++++++++++++-
 5 files changed, 67 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/c2ad0c32/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ProducerView.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ProducerView.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ProducerView.java
index e211b75..788616c 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ProducerView.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ProducerView.java
@@ -124,16 +124,15 @@ public class ProducerView implements ProducerViewMBean {
     }
 
     @Override
+    @Deprecated
     public boolean isDispatchAsync() {
-        if (info != null) {
-            return info.isDispatchAsync();
-        }
         return false;
     }
 
     /**
      * @return pretty print
      */
+    @Override
     public String toString() {
         return "ProducerView: " + getClientId() + ":" + getConnectionId();
     }

http://git-wip-us.apache.org/repos/asf/activemq/blob/c2ad0c32/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ProducerViewMBean.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ProducerViewMBean.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ProducerViewMBean.java
index cdf3754..b9d662a 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ProducerViewMBean.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ProducerViewMBean.java
@@ -73,8 +73,10 @@ public interface ProducerViewMBean {
     int getProducerWindowSize();
 
     /**
+     * @deprecated This value is no longer used for producers.
      * @return if the Producer is configured for Async dispatch
      */
+    @Deprecated
     @MBeanInfo("Is the producer configured for Async Dispatch")
     boolean isDispatchAsync();
 

http://git-wip-us.apache.org/repos/asf/activemq/blob/c2ad0c32/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionView.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionView.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionView.java
index 85f1f14..663220e 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionView.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionView.java
@@ -267,6 +267,15 @@ public class SubscriptionView implements SubscriptionViewMBean {
     }
 
     /**
+     * @return whether or not the subscriber is configured for async dispatch
+     */
+    @Override
+    public boolean isDispatchAsync() {
+        ConsumerInfo info = getConsumerInfo();
+        return info != null ? info.isDispatchAsync() : false;
+    }
+
+    /**
      * @return the maximum number of pending messages allowed in addition to the
      *         prefetch size. If enabled to a non-zero value then this will
      *         perform eviction of messages for slow consumers on non-durable

http://git-wip-us.apache.org/repos/asf/activemq/blob/c2ad0c32/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java
index f1dbf26..189bebb 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java
@@ -161,6 +161,12 @@ public interface SubscriptionViewMBean {
     boolean isNoLocal();
 
     /**
+     * @return if the Consumer is configured for Async dispatch
+     */
+    @MBeanInfo("Is the consumer configured for Async Dispatch")
+    boolean isDispatchAsync();
+
+    /**
      * @return the maximum number of pending messages allowed in addition to the
      *         prefetch size. If enabled to a non-zero value then this will
      *         perform eviction of messages for slow consumers on non-durable

http://git-wip-us.apache.org/repos/asf/activemq/blob/c2ad0c32/activemq-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
index b2d690e..e03cb46 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
@@ -1790,4 +1790,51 @@ public class MBeanTest extends EmbeddedBrokerTestSupport {
             assertEquals(1, subscriberView.getDequeueCounter());
         }
     }
-}
+
+    public void testSubscriptionViewProperties() throws Exception {
+        connection = createConnection();
+        connection.start();
+
+        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+        Topic topic1 = session.createTopic("test.topic1?consumer.dispatchAsync=false&consumer.retroactive=true");
+        Topic topic2 = session.createTopic("test.topic2?consumer.dispatchAsync=true&consumer.retroactive=false&consumer.exclusive=true");
+        MessageConsumer consumer1 = session.createConsumer(topic1);
+        MessageConsumer consumer2 = session.createConsumer(topic2);
+
+        assertNotNull(consumer1);
+        assertNotNull(consumer2);
+
+        ObjectName topicObjName = assertRegisteredObjectName(
+            domain + ":type=Broker,brokerName=localhost,destinationType=Topic,destinationName="
+ topic1.getTopicName());
+        final TopicViewMBean topic1View = MBeanServerInvocationHandler.newProxyInstance(mbeanServer,
topicObjName, TopicViewMBean.class, true);
+        ArrayList<SubscriptionViewMBean> subscriberViews = new ArrayList<SubscriptionViewMBean>();
+        for (ObjectName name : topic1View.getSubscriptions()) {
+            subscriberViews.add(MBeanServerInvocationHandler.newProxyInstance(mbeanServer,
name, SubscriptionViewMBean.class, true));
+        }
+
+        assertEquals(1, subscriberViews.size());
+
+        SubscriptionViewMBean subscription = subscriberViews.get(0);
+
+        assertFalse(subscription.isDispatchAsync());
+        assertTrue(subscription.isRetroactive());
+        assertFalse(subscription.isExclusive());
+
+        topicObjName = assertRegisteredObjectName(
+            domain + ":type=Broker,brokerName=localhost,destinationType=Topic,destinationName="
+ topic2.getTopicName());
+        final TopicViewMBean topic2View = MBeanServerInvocationHandler.newProxyInstance(mbeanServer,
topicObjName, TopicViewMBean.class, true);
+        subscriberViews = new ArrayList<SubscriptionViewMBean>();
+        for (ObjectName name : topic2View.getSubscriptions()) {
+            subscriberViews.add(MBeanServerInvocationHandler.newProxyInstance(mbeanServer,
name, SubscriptionViewMBean.class, true));
+        }
+
+        assertEquals(1, subscriberViews.size());
+
+        subscription = subscriberViews.get(0);
+
+        assertTrue(subscription.isDispatchAsync());
+        assertFalse(subscription.isRetroactive());
+        assertTrue(subscription.isExclusive());
+    }
+}
\ No newline at end of file


Mime
View raw message