Examples of ManagementContext


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

                    }
                }
            }
           
            // 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

        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.activemq.broker.jmx.ManagementContext

        messageConsumer.close();

    }

    protected void assertExactMessageCount(final String brokerName, Destination destination, final int count, long timeout) throws Exception {
        ManagementContext context = brokers.get(brokerName).broker.getManagementContext();
        final QueueViewMBean queueViewMBean = (QueueViewMBean) context.newProxyInstance(brokers.get(brokerName).broker.getAdminView().getQueues()[0], QueueViewMBean.class, false);
        assertTrue("Excepected queue depth: " + count + " on: " + brokerName, Wait.waitFor(new Wait.Condition() {
            @Override
            public boolean isSatisified() throws Exception {
                long currentCount = queueViewMBean.getQueueSize();
                LOG.info("On " + brokerName + " current queue size for " + queueViewMBean + ", " + currentCount);
View Full Code Here

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

            }
        }, timeout));
    }

    protected void assertExactConsumersConnect(final String brokerName, Destination destination, final int count, long timeout) throws Exception {
        final ManagementContext context = brokers.get(brokerName).broker.getManagementContext();
        assertTrue("Excepected consumers count: " + count + " on: " + brokerName, Wait.waitFor(new Wait.Condition() {
            @Override
            public boolean isSatisified() throws Exception {
                try {
                    QueueViewMBean queueViewMBean = (QueueViewMBean) context.newProxyInstance(brokers.get(brokerName).broker.getAdminView().getQueues()[0], QueueViewMBean.class, false);
                    long currentCount = queueViewMBean.getConsumerCount();
                    LOG.info("On " + brokerName + " current consumer count for " + queueViewMBean + ", " + currentCount);
                    if (count != currentCount) {
                        LOG.info("Sub IDs: " + Arrays.asList(queueViewMBean.getSubscriptions()));
                    }
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

    private void createLocalBroker() throws Exception {
        localBroker = new BrokerService();
        localBroker.setBrokerName("LOCAL");
        localBroker.setUseJmx(true);
        localBroker.setSchedulePeriodForDestinationPurge(5000);
        ManagementContext managementContext = new ManagementContext();
        managementContext.setCreateConnector(false);
        localBroker.setManagementContext(managementContext);
        PersistenceAdapter persistenceAdapter = persistanceAdapterFactory("target/local");
        localBroker.setPersistenceAdapter(persistenceAdapter);
        List<TransportConnector> transportConnectors = new ArrayList<TransportConnector>();
        DebugTransportFactory tf = new DebugTransportFactory();
View Full Code Here

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

    private void createRemoteBroker() throws Exception {
        remoteBroker = new BrokerService();
        remoteBroker.setBrokerName("REMOTE");
        remoteBroker.setUseJmx(true);
        remoteBroker.setSchedulePeriodForDestinationPurge(5000);
        ManagementContext managementContext = new ManagementContext();
        managementContext.setCreateConnector(false);
        remoteBroker.setManagementContext(managementContext);
        PersistenceAdapter persistenceAdapter = persistanceAdapterFactory("target/remote");
        remoteBroker.setPersistenceAdapter(persistenceAdapter);
        List<NetworkConnector> networkConnectors = new ArrayList<NetworkConnector>();
        DiscoveryNetworkConnector networkConnector = new DiscoveryNetworkConnector();
View Full Code Here

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

        }

    }

    protected void assertExactConsumersConnect(final String brokerName, final int count, final int numChecks, long timeout) throws Exception {
        final ManagementContext context = brokers.get(brokerName).broker.getManagementContext();
        final AtomicInteger stability = new AtomicInteger(0);
        assertTrue("Expected consumers count: " + count + " on: " + brokerName, Wait.waitFor(new Wait.Condition() {
            @Override
            public boolean isSatisified() throws Exception {
                try {
                    QueueViewMBean queueViewMBean = (QueueViewMBean) context.newProxyInstance(brokers.get(brokerName).broker.getAdminView().getQueues()[0], QueueViewMBean.class, false);
                    long currentCount = queueViewMBean.getConsumerCount();
                    LOG.info("On " + brokerName + " current consumer count for " + queueViewMBean + ", " + currentCount);
                    LinkedList<String> consumerIds = new LinkedList<String>();
                    for (ObjectName objectName : queueViewMBean.getSubscriptions()) {
                        consumerIds.add(objectName.getKeyProperty("consumerId"));
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
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.