1 18 package org.apache.activemq.broker; 19 20 import org.apache.activemq.broker.region.Destination; 21 import org.apache.activemq.broker.region.Subscription; 22 import org.apache.activemq.broker.region.policy.PendingDurableSubscriberMessageStoragePolicy; 23 import org.apache.activemq.command.ActiveMQDestination; 24 import org.apache.activemq.command.BrokerId; 25 import org.apache.activemq.command.BrokerInfo; 26 import org.apache.activemq.command.ConnectionInfo; 27 import org.apache.activemq.command.ConsumerInfo; 28 import org.apache.activemq.command.DestinationInfo; 29 import org.apache.activemq.command.Message; 30 import org.apache.activemq.command.MessageAck; 31 import org.apache.activemq.command.MessageDispatch; 32 import org.apache.activemq.command.MessageDispatchNotification; 33 import org.apache.activemq.command.MessagePull; 34 import org.apache.activemq.command.ProducerInfo; 35 import org.apache.activemq.command.RemoveSubscriptionInfo; 36 import org.apache.activemq.command.Response; 37 import org.apache.activemq.command.SessionInfo; 38 import org.apache.activemq.command.TransactionId; 39 import org.apache.activemq.kaha.Store; 40 41 import java.net.URI ; 42 import java.util.Map ; 43 import java.util.Set ; 44 45 52 public class MutableBrokerFilter implements Broker { 53 54 private Broker next; 55 private final Object mutext = new Object (); 56 57 public MutableBrokerFilter(Broker next) { 58 this.next = next; 59 } 60 61 public Broker getAdaptor(Class type){ 62 if (type.isInstance(this)){ 63 return this; 64 } 65 return next.getAdaptor(type); 66 } 67 68 public Broker getNext() { 69 synchronized(mutext) { 70 return next; 71 } 72 } 73 74 public void setNext(Broker next) { 75 synchronized(mutext) { 76 this.next=next; 77 } 78 } 79 80 public Map getDestinationMap() { 81 return getNext().getDestinationMap(); 82 } 83 84 public Set getDestinations(ActiveMQDestination destination) { 85 return getNext().getDestinations(destination); 86 } 87 88 public void acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack) throws Exception { 89 getNext().acknowledge(consumerExchange, ack); 90 } 91 92 public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception { 93 getNext().addConnection(context, info); 94 } 95 96 public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception { 97 return getNext().addConsumer(context, info); 98 } 99 100 public void addProducer(ConnectionContext context, ProducerInfo info) throws Exception { 101 getNext().addProducer(context, info); 102 } 103 104 public void commitTransaction(ConnectionContext context, TransactionId xid, boolean onePhase) throws Exception { 105 getNext().commitTransaction(context, xid, onePhase); 106 } 107 108 public void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception { 109 getNext().removeSubscription(context, info); 110 } 111 112 public TransactionId[] getPreparedTransactions(ConnectionContext context) throws Exception { 113 return getNext().getPreparedTransactions(context); 114 } 115 116 public int prepareTransaction(ConnectionContext context, TransactionId xid) throws Exception { 117 return getNext().prepareTransaction(context, xid); 118 } 119 120 public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception { 121 getNext().removeConnection(context, info, error); 122 } 123 124 public void removeConsumer(ConnectionContext context, ConsumerInfo info) throws Exception { 125 getNext().removeConsumer(context, info); 126 } 127 128 public void removeProducer(ConnectionContext context, ProducerInfo info) throws Exception { 129 getNext().removeProducer(context, info); 130 } 131 132 public void rollbackTransaction(ConnectionContext context, TransactionId xid) throws Exception { 133 getNext().rollbackTransaction(context, xid); 134 } 135 136 public void send(ProducerBrokerExchange producerExchange, Message messageSend) throws Exception { 137 getNext().send(producerExchange, messageSend); 138 } 139 140 public void beginTransaction(ConnectionContext context, TransactionId xid) throws Exception { 141 getNext().beginTransaction(context, xid); 142 } 143 144 public void forgetTransaction(ConnectionContext context, TransactionId transactionId) throws Exception { 145 getNext().forgetTransaction(context, transactionId); 146 } 147 148 public Connection[] getClients() throws Exception { 149 return getNext().getClients(); 150 } 151 152 public Destination addDestination(ConnectionContext context, ActiveMQDestination destination) throws Exception { 153 return getNext().addDestination(context, destination); 154 } 155 156 public void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout) throws Exception { 157 getNext().removeDestination(context, destination, timeout); 158 } 159 160 public ActiveMQDestination[] getDestinations() throws Exception { 161 return getNext().getDestinations(); 162 } 163 164 public void start() throws Exception { 165 getNext().start(); 166 } 167 168 public void stop() throws Exception { 169 getNext().stop(); 170 } 171 172 public void addSession(ConnectionContext context, SessionInfo info) throws Exception { 173 getNext().addSession(context, info); 174 } 175 176 public void removeSession(ConnectionContext context, SessionInfo info) throws Exception { 177 getNext().removeSession(context, info); 178 } 179 180 public BrokerId getBrokerId() { 181 return getNext().getBrokerId(); 182 } 183 184 public String getBrokerName() { 185 return getNext().getBrokerName(); 186 } 187 188 public void gc() { 189 getNext().gc(); 190 } 191 192 public void addBroker(Connection connection,BrokerInfo info){ 193 getNext().addBroker(connection, info); 194 } 195 196 public void removeBroker(Connection connection,BrokerInfo info){ 197 getNext().removeBroker(connection, info); 198 } 199 200 public BrokerInfo[] getPeerBrokerInfos(){ 201 return getNext().getPeerBrokerInfos(); 202 } 203 204 public void processDispatch(MessageDispatch messageDispatch){ 205 getNext().processDispatch(messageDispatch); 206 } 207 208 public void processDispatchNotification(MessageDispatchNotification messageDispatchNotification) throws Exception { 209 getNext().processDispatchNotification(messageDispatchNotification); 210 } 211 212 public boolean isSlaveBroker(){ 213 return getNext().isSlaveBroker(); 214 } 215 216 public boolean isStopped(){ 217 return getNext().isStopped(); 218 } 219 220 public Set getDurableDestinations(){ 221 return getNext().getDurableDestinations(); 222 } 223 224 public void addDestinationInfo(ConnectionContext context,DestinationInfo info) throws Exception { 225 getNext().addDestinationInfo(context, info); 226 227 } 228 229 public void removeDestinationInfo(ConnectionContext context,DestinationInfo info) throws Exception { 230 getNext().removeDestinationInfo(context, info); 231 232 } 233 234 public boolean isFaultTolerantConfiguration(){ 235 return getNext().isFaultTolerantConfiguration(); 236 } 237 238 public ConnectionContext getAdminConnectionContext() { 239 return getNext().getAdminConnectionContext(); 240 } 241 242 public void setAdminConnectionContext(ConnectionContext adminConnectionContext) { 243 getNext().setAdminConnectionContext(adminConnectionContext); 244 } 245 246 public Response messagePull(ConnectionContext context, MessagePull pull) throws Exception { 247 return getNext().messagePull(context, pull); 248 } 249 250 public Store getTempDataStore() { 251 return getNext().getTempDataStore(); 252 } 253 254 public URI getVmConnectorURI(){ 255 return getNext().getVmConnectorURI(); 256 } 257 258 } 259 | Popular Tags |