Examples of ManagementContext


Examples of org.apache.activemq.broker.jmx.ManagementContext

    private void configureMBeanServer(BrokerService brokerService, int port) throws IOException {
        // shared fs master/slave
        brokerService.getPersistenceAdapter().setDirectory(
                new File(brokerService.getDataDirectoryFile(), "shared"));

        ManagementContext managementContext = brokerService.getManagementContext();

        // have mbean servers remain alive - like in karaf container
        MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer(managementContext.getJmxDomainName());

        Registry registry = LocateRegistry.createRegistry(port + 1);

        JMXConnectorServer connectorServer =
                        JMXConnectorServerFactory.newJMXConnectorServer(
                                new JMXServiceURL(
                                    "service:jmx:rmi://localhost:"  + port + "/jndi/rmi://localhost:" + (port + 1) + "/jmxrmi"),
                                null, mbeanServer);

        connectorServer.start();
        serverList.addFirst(connectorServer);

        managementContext.setMBeanServer(mbeanServer);
        managementContext.setCreateConnector(false);
    }
View Full Code Here

Examples of org.apache.activemq.broker.jmx.ManagementContext

        protected BrokerService createBroker() throws Exception {
        BrokerService answer = new BrokerService();
        answer.setPersistent(isPersistent());
        answer.addConnector(bindAddress);
        ManagementContext context = new ManagementContext();
        context.setConnectorPort(1199);
        answer.setManagementContext(context);
        return answer;
    }
View Full Code Here

Examples of org.apache.activemq.broker.jmx.ManagementContext

                    }
                }
            }
           
            // Do not allow creation of another ConnectorServer
            ManagementContext mgmtctx = new ManagementContext(mbeanServerReference != null ? mbeanServerReference.getMBeanServer() : null);
            mgmtctx.setCreateConnector(false);
            brokerService.setManagementContext(mgmtctx);

            // Do not allow the broker to use a shutown hook, the kernel will stop it
            brokerService.setUseShutdownHook(isUseShutdownHook());
View Full Code Here

Examples of org.apache.activemq.broker.jmx.ManagementContext

        this.brokerObjectName = brokerObjectName;
    }

    public ManagementContext getManagementContext() {
        if (managementContext == null) {
            managementContext = new ManagementContext();
        }
        return managementContext;
    }
View Full Code Here

Examples of org.apache.activemq.broker.jmx.ManagementContext

        params.put("type", "Broker");
        params.put("destinationType", "Queue");
        params.put("destinationName", queueName);
        ObjectName queueObjectName = ObjectName.getInstance(amqDomain, params);

        ManagementContext mgmtCtx = broker.getManagementContext();
        QueueViewMBean queueView = (QueueViewMBean)mgmtCtx.newProxyInstance(queueObjectName, QueueViewMBean.class, true);

        Object[] messages = queueView.browse();

        LOG.info("+Browsed with JMX: " + messages.length);
View Full Code Here

Examples of org.apache.activemq.broker.jmx.ManagementContext

        broker.setBrokerName("localhost");
        broker.setUseJmx(true);
        broker.setDeleteAllMessagesOnStartup(deleteAllMessagesOnStartup);
        broker.addConnector("tcp://localhost:0");

        ManagementContext ctx = new ManagementContext();
        //if createConnector == true everything is fine
        ctx.setCreateConnector(false);
        broker.setManagementContext(ctx);

        broker.start();
        broker.waitUntilStarted();
View Full Code Here

Examples of org.apache.activemq.broker.jmx.ManagementContext

        System.out.println("Starting broker");
        System.out.flush();
        broker = new BrokerService();
        broker.setPersistent(false);
        ManagementContext ctx = new ManagementContext(ManagementFactory.getPlatformMBeanServer());
        ctx.setConnectorPort(jmxport);
        broker.setManagementContext(ctx);
        broker.setUseJmx(true);
//        broker.setAdvisorySupport(false);
//        broker.setDeleteAllMessagesOnStartup(true);
View Full Code Here

Examples of org.apache.activemq.broker.jmx.ManagementContext

        super.stop();
    }

    private void registerMbean() {
        if (getBrokerService().isUseJmx()) {
            ManagementContext managementContext = getBrokerService().getManagementContext();
            try {
                objectName = new ObjectName(getBrokerService().getBrokerObjectName().toString() + objectNamePropsAppendage);
                managementContext.registerMBean(new RuntimeConfigurationView(this), objectName);
            } catch (Exception ignored) {
                LOG.debug("failed to register RuntimeConfigurationMBean", ignored);
            }
        }
    }
View Full Code Here

Examples of org.apache.servicemix.jbi.management.ManagementContext

    private void createComponentStats(JBIContainer container, ComponentMBeanImpl component) {
        String key = component.getName();
        ComponentStats stats = new ComponentStats(component);
        componentStats.putIfAbsent(key, stats);
        // Register MBean
        ManagementContext context = container.getManagementContext();
        try {
            context.registerMBean(context.createObjectName(context.createObjectNameProps(stats, true)),
                    stats,
                    ComponentStatsMBean.class);
        } catch (Exception e) {
            LOG.info("Unable to register component statistics MBean: " + e.getMessage());
            if (LOG.isDebugEnabled()) {
View Full Code Here

Examples of org.apache.servicemix.jbi.management.ManagementContext

        ComponentStats stats = componentStats.remove(key);
        if (stats == null) {
            return;
        }
        // Register MBean
        ManagementContext context = container.getManagementContext();
        try {
            context.unregisterMBean(context.createObjectName(context.createObjectNameProps(stats, true)));
        } catch (Exception e) {
            LOG.info("Unable to unregister component statistics MBean: " + e);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Unable to unregister component statistics MBean", e);
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.