@Override public BrokerService getBrokerService() { return getNext().getBrokerService(); }
@Override public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception { super.addConnection(context, info); this.contextBroker.getBrokerService().incrementCurrentConnections(); this.contextBroker.getBrokerService().incrementTotalConnections(); }
public void setLastStoredSequenceId(long l) { auditProducerSequenceIds = true; if (connectionContext.isNetworkConnection()) { brokerService = connectionContext.getBroker().getBrokerService(); isNetworkProducer = true; } lastSendSequenceNumber.set(l); LOG.debug("last stored sequence id set: {}", l); }
@Override public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception { super.removeConnection(context, info, error); this.contextBroker.getBrokerService().decrementCurrentConnections(); }
@Override public Broker installPlugin(Broker broker) throws Exception { if (!broker.getBrokerService().isSchedulerSupport()) { throw new IllegalStateException("RedeliveryPlugin requires schedulerSupport=true on the broker"); } validatePolicyDelay(1000); return super.installPlugin(broker); }
private boolean hasNoLocalChanged(SubscriptionInfo info1, ConsumerInfo info2) throws IOException { //Not all persistence adapters store the noLocal value for a subscription PersistenceAdapter adapter = broker.getBrokerService().getPersistenceAdapter(); if (adapter instanceof NoLocalSubscriptionAware) { if (info1.isNoLocal() ^ info2.isNoLocal()) { return true; } } return false; }
@Override public void start() throws Exception { if (started.compareAndSet(false, true)) { if( this.broker != null) { wireFormat.setVersion(this.broker.getBrokerService().getStoreOpenWireVersion()); } super.start(); if (systemUsage != null) { systemUsage.getMemoryUsage().addUsageListener(this); } } }
@Override protected void doFillBatch() throws Exception { hadSpace = this.hasSpace(); if (!broker.getBrokerService().isPersistent() || hadSpace) { this.store.recoverNextMessages(this.maxBatchSize, this); dealWithDuplicates(); // without the index lock } }
/** * @returns the ObjectName of the Connection that created this subscription */ @Override public ObjectName getConnection() { ObjectName result = null; if (clientId != null && subscription != null) { ConnectionContext ctx = subscription.getContext(); if (ctx != null && ctx.getBroker() != null && ctx.getBroker().getBrokerService() != null) { BrokerService service = ctx.getBroker().getBrokerService(); ManagementContext managementCtx = service.getManagementContext(); if (managementCtx != null) { try { ObjectName query = createConnectionQuery(managementCtx, service.getBrokerName()); Set<ObjectName> names = managementCtx.queryNames(query, null); if (names.size() == 1) { result = names.iterator().next(); } } catch (Exception e) { } } } } return result; }
final BrokerService brokerService = context.getConnectionContext().getBroker().getBrokerService(); for (final ActiveMQDestination destination : matchingDestinations) { if (concurrent.getCount() > 0) {
public ManagedTransportConnection(TransportConnector connector, Transport transport, Broker broker, TaskRunnerFactory factory, TaskRunnerFactory stopFactory, ManagementContext context, ObjectName connectorName) throws IOException { super(connector, transport, broker, factory, stopFactory); this.managementContext = context; this.connectorName = connectorName; this.mbean = new ConnectionView(this, managementContext); this.populateUserName = broker.getBrokerService().isPopulateUserNameInMBeans(); if (managementContext.isAllowRemoteAddressInMBeanNames()) { byAddressName = createObjectName("remoteAddress", transport.getRemoteAddress()); registerMBean(byAddressName); } }
final BrokerService brokerService = broker.getBrokerService();
/** * @param broker Broker for this cursor * @param clientId clientId for this cursor * @param subscriberName subscriber name for this cursor * @param maxBatchSize currently ignored * @param subscription subscription for this cursor */ public StoreDurableSubscriberCursor(Broker broker,String clientId, String subscriberName,int maxBatchSize, DurableTopicSubscription subscription) { super(AbstractPendingMessageCursor.isPrioritizedMessageSubscriber(broker,subscription)); this.subscription=subscription; this.clientId = clientId; this.subscriberName = subscriberName; if (broker.getBrokerService().isPersistent()) { this.nonPersistent = new FilePendingMessageCursor(broker,clientId + subscriberName,this.prioritizedMessages); } else { this.nonPersistent = new VMPendingMessageCursor(this.prioritizedMessages); } this.nonPersistent.setMaxBatchSize(maxBatchSize); this.nonPersistent.setSystemUsage(systemUsage); this.storePrefetches.add(this.nonPersistent); if (prioritizedMessages) { setMaxAuditDepth(10*getMaxAuditDepth()); } }
@Override public void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception { SubscriptionKey key = new SubscriptionKey(context.getClientId(), info.getSubscriptionName()); RegionBroker regionBroker = null; if (next instanceof RegionBroker) { regionBroker = (RegionBroker) next; } else { BrokerService service = next.getBrokerService(); regionBroker = (RegionBroker) service.getRegionBroker(); } if (regionBroker == null) { LOG.warn("Cannot locate a RegionBroker instance to pass along the removeSubscription call"); throw new IllegalStateException("No RegionBroker found."); } DurableTopicSubscription sub = ((TopicRegion) regionBroker.getTopicRegion()).getDurableSubscription(key); super.removeSubscription(context, info); if (sub == null) { LOG.warn("We cannot send an advisory message for a durable sub removal when we don't know about the durable sub"); return; } ActiveMQDestination dest = sub.getConsumerInfo().getDestination(); // Don't advise advisory topics. if (!AdvisorySupport.isAdvisoryTopic(dest)) { ActiveMQTopic topic = AdvisorySupport.getConsumerAdvisoryTopic(dest); fireConsumerAdvisory(context, dest, topic, info); } }
if (config.isSyncDurableSubs() && protocolVersion.get() >= CommandTypes.PROTOCOL_VERSION_DURABLE_SYNC) { LOG.debug("SyncDurableSubs is enabled, Sending BrokerSubscriptionInfo"); dispatchSync(NetworkBridgeUtils.getBrokerSubscriptionInfo(this.broker.getBrokerService(), config)); dispatchSync(NetworkBridgeUtils.getBrokerSubscriptionInfo(this.broker.getBrokerService(), config));
this.connector = connector; this.broker = broker; this.brokerService = broker.getBrokerService();
@Override public synchronized void start() throws Exception { started = true; super.start(); if (nonPersistent == null) { if (broker.getBrokerService().isPersistent()) { nonPersistent = new FilePendingMessageCursor(broker,queue.getName(),this.prioritizedMessages); }else { nonPersistent = new VMPendingMessageCursor(this.prioritizedMessages); } nonPersistent.setMaxBatchSize(getMaxBatchSize()); nonPersistent.setSystemUsage(systemUsage); nonPersistent.setEnableAudit(isEnableAudit()); nonPersistent.setMaxAuditDepth(getMaxAuditDepth()); nonPersistent.setMaxProducersToAudit(getMaxProducersToAudit()); } nonPersistent.setMessageAudit(getMessageAudit()); nonPersistent.start(); persistent.setMessageAudit(getMessageAudit()); persistent.start(); pendingCount = persistent.size() + nonPersistent.size(); }
brokerInfo.setPeerBrokerInfos(broker.getPeerBrokerInfos()); brokerInfo.setFaultTolerantConfiguration(broker.isFaultTolerantConfiguration()); brokerInfo.setBrokerURL(broker.getBrokerService().getDefaultSocketURIString()); getServer().setAcceptListener(new TransportAcceptListener() { @Override
public void setLastStoredSequenceId(long l) { auditProducerSequenceIds = true; if (connectionContext.isNetworkConnection()) { brokerService = connectionContext.getBroker().getBrokerService(); isNetworkProducer = true; } lastSendSequenceNumber.set(l); LOG.debug("last stored sequence id set: {}", l); }
@Override public Broker installPlugin(Broker broker) throws Exception { if (!broker.getBrokerService().isSchedulerSupport()) { throw new IllegalStateException("RedeliveryPlugin requires schedulerSupport=true on the broker"); } validatePolicyDelay(1000); return super.installPlugin(broker); }