protected void unregisterPersistenceAdapterMBean(PersistenceAdapter adaptor) throws IOException { if (isUseJmx()) {} }
public JmsConnector addJmsConnector(JmsConnector connector) throws Exception { connector.setBrokerService(this); jmsConnectors.add(connector); if (isUseJmx()) { registerJmsConnectorMBean(connector); } return connector; }
private void purgeInactiveDestinationViews() { if (!brokerService.isUseJmx()) { return; } purgeInactiveDestinationView(inboundDestinationViewMap); purgeInactiveDestinationView(outboundDestinationViewMap); }
protected void unregisterNetworkConnectorMBean(NetworkConnector connector) { if (isUseJmx()) { try { ObjectName objectName = createNetworkConnectorObjectName(connector); getManagementContext().unregisterMBean(objectName); } catch (Exception e) { LOG.warn("Network Connector could not be unregistered from JMX due " + e.getMessage() + ". This exception is ignored.", e); } } }
public ProxyConnector addProxyConnector(ProxyConnector connector) throws Exception { URI uri = getVmConnectorURI(); connector.setLocalUri(uri); proxyConnectors.add(connector); if (isUseJmx()) { registerProxyConnectorMBean(connector); } return connector; }
private void unregisterMBeans() { BrokerService broker = getBrokerService(); if (broker.isUseJmx() && this.objectName != null) { try { broker.getManagementContext().unregisterMBean(objectName); } catch (JMException e) { LOG.warn("Trying uninstall VirtualDestinationSelectorCache; couldn't uninstall mbeans, continuting..."); } } }
public void stop() { if (!brokerService.isUseJmx()) { return; } scheduler.cancel(purgeInactiveDestinationViewTask); for (NetworkDestinationContainer networkDestinationContainer : inboundDestinationViewMap.values()) { try { brokerService.getManagementContext().unregisterMBean(networkDestinationContainer.objectName); } catch (Exception e) { LOG.error("Network bridge could not be unregistered in JMX: {}", e.getMessage(), e); } } for (NetworkDestinationContainer networkDestinationContainer : outboundDestinationViewMap.values()) { try { brokerService.getManagementContext().unregisterMBean(networkDestinationContainer.objectName); } catch (Exception e) { LOG.debug("Network bridge could not be unregistered in JMX: {}", e.getMessage(), e); } } inboundDestinationViewMap.clear(); outboundDestinationViewMap.clear(); }
protected void unregisterConnectorMBean(TransportConnector connector) throws IOException { if (isUseJmx()) { try { ObjectName objectName = createConnectorObjectName(connector); getManagementContext().unregisterMBean(objectName); } catch (Throwable e) { throw IOExceptionSupport.create( "Transport Connector could not be unregistered in JMX: " + e.getMessage(), e); } } }
protected void unregisterNetworkBridgeMBean(NetworkBridge bridge) { if (!getBrokerService().isUseJmx()) { return; } try { ObjectName objectName = createNetworkBridgeObjectName(bridge); getBrokerService().getManagementContext().unregisterMBean(objectName); } catch (Throwable e) { LOG.debug("Network bridge could not be unregistered in JMX: {}", e.getMessage(), e); } }
@Override public void onStop(NetworkBridge bridge) { if (!brokerService.isUseJmx()) { return; } try { ObjectName objectName = bridge.getMbeanObjectName(); if (objectName != null) { brokerService.getManagementContext().unregisterMBean(objectName); } MBeanBridgeDestination mBeanBridgeDestination = destinationObjectNameMap.remove(bridge); if (mBeanBridgeDestination != null){ mBeanBridgeDestination.stop(); } } catch (Throwable e) { LOG.debug("Network bridge could not be unregistered in JMX: {}", e.getMessage(), e); } }
private void enableJmx() { BrokerService broker = getBrokerService(); if (broker.isUseJmx()) { VirtualDestinationSelectorCacheView view = new VirtualDestinationSelectorCacheView(this); try { objectName = BrokerMBeanSupport.createVirtualDestinationSelectorCacheName(broker.getBrokerObjectName(), "plugin", "virtualDestinationCache"); LOG.trace("virtualDestinationCacheSelector mbean name; " + objectName.toString()); AnnotatedMBean.registerMBean(broker.getManagementContext(), view, objectName); } catch (Exception e) { LOG.warn("JMX is enabled, but when installing the VirtualDestinationSelectorCache, couldn't install the JMX mbeans. Continuing without installing the mbeans."); } } }
protected void registerNetworkBridgeMBean(NetworkBridge bridge) { if (!getBrokerService().isUseJmx()) { return; } NetworkBridgeViewMBean view = new NetworkBridgeView(bridge); try { ObjectName objectName = createNetworkBridgeObjectName(bridge); AnnotatedMBean.registerMBean(getBrokerService().getManagementContext(), view, objectName); } catch (Throwable e) { LOG.debug("Network bridge could not be registered in JMX: {}", e.getMessage(), e); } }
/** * @throws Exception * @see org.apache.activemq.Service#stop() */ @Override public void doStop(ServiceStopper stopper) throws Exception { this.letter.stop(); if (brokerService != null && brokerService.isUseJmx()) { ObjectName brokerObjectName = brokerService.getBrokerObjectName(); brokerService.getManagementContext().unregisterMBean(createPersistenceAdapterName(brokerObjectName.toString(), toString())); } }
@Override public void onStart(NetworkBridge bridge) { if (!brokerService.isUseJmx()) { return; } NetworkBridgeView view = new NetworkBridgeView(bridge); view.setCreateByDuplex(createdByDuplex); try { ObjectName objectName = createNetworkBridgeObjectName(bridge); AnnotatedMBean.registerMBean(brokerService.getManagementContext(), view, objectName); bridge.setMbeanObjectName(objectName); MBeanBridgeDestination mBeanBridgeDestination = new MBeanBridgeDestination(brokerService,networkBridgeConfiguration,bridge,view); destinationObjectNameMap.put(bridge,mBeanBridgeDestination); mBeanBridgeDestination.start(); LOG.debug("registered: {} as: {}", bridge, objectName); } catch (Throwable e) { LOG.debug("Network bridge could not be registered in JMX: {}", e.getMessage(), e); } }
if (isUseJmx()) {
/** * @throws Exception * @see org.apache.activemq.Service#start() */ @Override public void doStart() throws Exception { this.letter.start(); if (brokerService != null && brokerService.isUseJmx()) { PersistenceAdapterView view = new PersistenceAdapterView(this); view.setInflightTransactionViewCallable(new Callable<String>() { @Override public String call() throws Exception { return letter.getTransactions(); } }); view.setDataViewCallable(new Callable<String>() { @Override public String call() throws Exception { return letter.getJournal().getFileMap().keySet().toString(); } }); AnnotatedMBean.registerMBean(brokerService.getManagementContext(), view, createPersistenceAdapterName(brokerService.getBrokerObjectName().toString(), toString())); } }
if (isUseJmx()) { ObjectName networkMbean = createNetworkConnectorObjectName(connector); try {
public TransportConnector startTransportConnector(TransportConnector connector) throws Exception { connector.setBrokerService(this); connector.setTaskRunnerFactory(getTaskRunnerFactory()); MessageAuthorizationPolicy policy = getMessageAuthorizationPolicy(); if (policy != null) { connector.setMessageAuthorizationPolicy(policy); } if (isUseJmx()) { connector = registerConnectorMBean(connector); } connector.getStatistics().setEnabled(enableStatistics); connector.start(); return connector; }
broker.start(); if (isUseJmx()) { if (getManagementContext().isCreateConnector() && !getManagementContext().isConnectorStarted()) { if (isUseJmx() && Log4JConfigView.isLog4JAvailable()) { ObjectName objectName = BrokerMBeanSupport.createLog4JConfigViewName(getBrokerObjectName().toString()); Log4JConfigView log4jConfigView = new Log4JConfigView();
protected Broker createRegionBroker(DestinationInterceptor destinationInterceptor) throws IOException { RegionBroker regionBroker; if (isUseJmx()) { try { regionBroker = new ManagedRegionBroker(this, getManagementContext(), getBrokerObjectName(), getTaskRunnerFactory(), getConsumerSystemUsage(), destinationFactory, destinationInterceptor,getScheduler(),getExecutor()); } catch(MalformedObjectNameException me){ LOG.warn("Cannot create ManagedRegionBroker due " + me.getMessage(), me); throw new IOException(me); } } else { regionBroker = new RegionBroker(this, getTaskRunnerFactory(), getConsumerSystemUsage(), destinationFactory, destinationInterceptor,getScheduler(),getExecutor()); } destinationFactory.setRegionBroker(regionBroker); regionBroker.setKeepDurableSubsActive(keepDurableSubsActive); regionBroker.setBrokerName(getBrokerName()); regionBroker.getDestinationStatistics().setEnabled(enableStatistics); regionBroker.setAllowTempAutoCreationOnSend(isAllowTempAutoCreationOnSend()); if (brokerId != null) { regionBroker.setBrokerId(brokerId); } return regionBroker; }