activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r420835 - in /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx: BrokerViewMBean.java DurableSubscriptionView.java DurableSubscriptionViewMBean.java InactiveDurableSubscriptionView.java
Date Tue, 11 Jul 2006 13:21:27 GMT
Author: jstrachan
Date: Tue Jul 11 06:21:26 2006
New Revision: 420835

URL: http://svn.apache.org/viewvc?rev=420835&view=rev
Log:
added a destroy() method to durable subscription mbeans to make it a bit easier to delete
them via JMX. For more background see AMQ-811

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerViewMBean.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionView.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionViewMBean.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/InactiveDurableSubscriptionView.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerViewMBean.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerViewMBean.java?rev=420835&r1=420834&r2=420835&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerViewMBean.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerViewMBean.java
Tue Jul 11 06:21:26 2006
@@ -54,7 +54,7 @@
     public void terminateJVM(int exitCode);
     
     /**
-     * Stop the broker and all it's comonents.
+     * Stop the broker and all it's components.
      */
     public void stop() throws Exception;
     

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionView.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionView.java?rev=420835&r1=420834&r2=420835&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionView.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionView.java
Tue Jul 11 06:21:26 2006
@@ -16,7 +16,10 @@
 import javax.management.openmbean.CompositeData;
 import javax.management.openmbean.OpenDataException;
 import javax.management.openmbean.TabularData;
+
+import org.apache.activemq.broker.ConnectionContext;
 import org.apache.activemq.broker.region.Subscription;
+import org.apache.activemq.command.RemoveSubscriptionInfo;
 /**
  * @version $Revision: 1.5 $
  */
@@ -60,6 +63,19 @@
      */
     public TabularData browseAsTable() throws OpenDataException{
         return broker.browseAsTable(this);
+    }
+    
+    /**
+     * Destroys the durable subscription so that messages will no longer be stored for this
subscription
+     */
+    public void destroy() throws Exception {
+        RemoveSubscriptionInfo info = new RemoveSubscriptionInfo();
+        info.setClientId(clientId);
+        info.setSubcriptionName(subscriptionName);
+        ConnectionContext context = new ConnectionContext();
+        context.setBroker(broker);
+        context.setClientId(clientId);
+        broker.removeSubscription(context, info);
     }
     
     public String toString(){

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionViewMBean.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionViewMBean.java?rev=420835&r1=420834&r2=420835&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionViewMBean.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionViewMBean.java
Tue Jul 11 06:21:26 2006
@@ -13,6 +13,9 @@
  */
 package org.apache.activemq.broker.jmx;
 
+import org.apache.activemq.broker.ConnectionContext;
+import org.apache.activemq.command.RemoveSubscriptionInfo;
+
 import javax.management.openmbean.CompositeData;
 import javax.management.openmbean.OpenDataException;
 import javax.management.openmbean.TabularData;
@@ -40,4 +43,9 @@
      * @throws OpenDataException
      */
     public TabularData browseAsTable() throws OpenDataException;
+
+    /**
+     * Destroys the durable subscription so that messages will no longer be stored for this
subscription
+     */
+    public void destroy() throws Exception;
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/InactiveDurableSubscriptionView.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/InactiveDurableSubscriptionView.java?rev=420835&r1=420834&r2=420835&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/InactiveDurableSubscriptionView.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/InactiveDurableSubscriptionView.java
Tue Jul 11 06:21:26 2006
@@ -16,13 +16,19 @@
 import javax.management.openmbean.CompositeData;
 import javax.management.openmbean.OpenDataException;
 import javax.management.openmbean.TabularData;
+
+import org.apache.activemq.broker.ConnectionContext;
+import org.apache.activemq.command.RemoveSubscriptionInfo;
 import org.apache.activemq.command.SubscriptionInfo;
+
 /**
+ * TODO why does this class not inherit from DurableSubscriptionView?
+ * 
  * @version $Revision: 1.5 $
  */
 public class InactiveDurableSubscriptionView extends SubscriptionView implements  DurableSubscriptionViewMBean
{
     protected ManagedRegionBroker broker;
-    protected SubscriptionInfo info;
+    protected SubscriptionInfo subscriptionInfo;
     
     
     /**
@@ -34,7 +40,7 @@
     public InactiveDurableSubscriptionView(ManagedRegionBroker broker,String clientId,SubscriptionInfo
sub){
         super(clientId,null);
         this.broker = broker;
-        this.info = sub;
+        this.subscriptionInfo = sub;
     }
     
     
@@ -51,7 +57,7 @@
      * @return the destination name
      */
     public String getDestinationName(){
-        return info.getDestination().getPhysicalName();
+        return subscriptionInfo.getDestination().getPhysicalName();
        
     }
 
@@ -79,7 +85,7 @@
      * @return name of the durable consumer
      */
     public String getSubscriptionName(){
-        return info.getSubcriptionName();
+        return subscriptionInfo.getSubcriptionName();
     }
     
     /**
@@ -107,6 +113,19 @@
      */
     public TabularData browseAsTable() throws OpenDataException{
         return broker.browseAsTable(this);
+    }
+    
+    /**
+     * Destroys the durable subscription so that messages will no longer be stored for this
subscription
+     */
+    public void destroy() throws Exception {
+        RemoveSubscriptionInfo info = new RemoveSubscriptionInfo();
+        info.setClientId(clientId);
+        info.setSubcriptionName(subscriptionInfo.getSubcriptionName());
+        ConnectionContext context = new ConnectionContext();
+        context.setBroker(broker);
+        context.setClientId(clientId);
+        broker.removeSubscription(context, info);
     }
     
     public String toString(){



Mime
View raw message