1 18 package org.apache.activemq.broker.jmx; 19 20 import javax.management.openmbean.CompositeData ; 21 import javax.management.openmbean.OpenDataException ; 22 import javax.management.openmbean.TabularData ; 23 24 import org.apache.activemq.broker.ConnectionContext; 25 import org.apache.activemq.command.RemoveSubscriptionInfo; 26 import org.apache.activemq.command.SubscriptionInfo; 27 28 33 public class InactiveDurableSubscriptionView extends SubscriptionView implements DurableSubscriptionViewMBean { 34 protected ManagedRegionBroker broker; 35 protected SubscriptionInfo subscriptionInfo; 36 37 38 44 public InactiveDurableSubscriptionView(ManagedRegionBroker broker,String clientId,SubscriptionInfo sub){ 45 super(clientId,null); 46 this.broker = broker; 47 this.subscriptionInfo = sub; 48 } 49 50 51 52 53 56 public long getSubcriptionId(){ 57 return -1; 58 } 59 60 63 public String getDestinationName(){ 64 return subscriptionInfo.getDestination().getPhysicalName(); 65 66 } 67 68 71 public boolean isDestinationQueue(){ 72 return false; 73 } 74 75 78 public boolean isDestinationTopic(){ 79 return true; 80 } 81 82 85 public boolean isDestinationTemporary(){ 86 return false; 87 } 88 91 public String getSubscriptionName(){ 92 return subscriptionInfo.getSubcriptionName(); 93 } 94 95 98 public boolean isActive(){ 99 return false; 100 } 101 102 108 public CompositeData [] browse() throws OpenDataException { 109 return broker.browse(this); 110 } 111 112 118 public TabularData browseAsTable() throws OpenDataException { 119 return broker.browseAsTable(this); 120 } 121 122 125 public void destroy() throws Exception { 126 RemoveSubscriptionInfo info = new RemoveSubscriptionInfo(); 127 info.setClientId(clientId); 128 info.setSubcriptionName(subscriptionInfo.getSubcriptionName()); 129 ConnectionContext context = new ConnectionContext(); 130 context.setBroker(broker); 131 context.setClientId(clientId); 132 broker.removeSubscription(context, info); 133 } 134 135 public String toString(){ 136 return "InactiveDurableSubscriptionView: " + getClientId() + ":" + getSubscriptionName(); 137 } 138 } 139 | Popular Tags |