Package javax.management

Examples of javax.management.ObjectInstance


       
        Iterator iterator = (mserver.queryMBeans(rname, null).iterator());
       
        ArrayList results = new ArrayList();       
        while (iterator.hasNext()) {
            ObjectInstance instance = (ObjectInstance) iterator.next();
            results.add(instance.getObjectName().toString());
        }

        Collections.sort(results);

        UserDatabasesForm userDatabasesForm = new UserDatabasesForm();
View Full Code Here


    public ObjectInstance getObjectInstance(ObjectName objectName) throws InstanceNotFoundException {
        AbstractName abstractName = toAbstractName(objectName);
        try {
            GBeanInfo gbeanInfo = kernel.getGBeanInfo(abstractName);
            return new ObjectInstance(objectName, gbeanInfo.getClassName());
        } catch (GBeanNotFoundException e) {
            throw new InstanceNotFoundException(objectName.getCanonicalName());
        }
    }
View Full Code Here

                e.printStackTrace();
            }
        } else {
            try {
                m_objectName = new ObjectName(getObjectNameString());
                ObjectInstance instance = ManagementFactory
                    .getPlatformMBeanServer().registerMBean(m_MBean,
                        m_objectName);

                // we must retrieve object name used to register the MBean.
                // It can have been changed by preRegister method of
                // MBeanRegistration interface.
                if (m_registerCallbacks) {
                    m_objectName = instance.getObjectName();
                }

                m_registered = true;
            } catch (Exception e) {
                error("Registration of MBean failed.", e);
View Full Code Here

        System.out.println("There are " + server.getMBeanCount().intValue() +
                           " registered MBeans");
        Iterator instances = server.queryMBeans(null, null).iterator();
        while (instances.hasNext()) {
            ObjectInstance instance = (ObjectInstance) instances.next();
            System.out.println("  objectName=" + instance.getObjectName() +
                               ", className=" + instance.getClassName());
        }


    }
View Full Code Here

        MBeanServer mbeanServer = (MBeanServer) registry.getService(MBeanServer.class);
        ObjectNameBuilder objectNameBuilder = (ObjectNameBuilder) registry
                .getService(ObjectNameBuilder.class);
        ObjectName objectName = objectNameBuilder.createObjectName(logger.getName(), "logger");

        ObjectInstance instance = mbeanServer.getObjectInstance(objectName);
        assertNotNull(instance);

        registry.shutdown();
    }
View Full Code Here

        // Look for the mbean that collects the performance data
        MBeanServer mbeanServer = (MBeanServer) registry.getService(MBeanServer.class);
        ObjectName objectName = new ObjectName(
                "hivemind:module=test.management,type=service,id=Calculator,decorator=PerformanceCollector");
        ObjectInstance instance = mbeanServer.getObjectInstance(objectName);
        assertNotNull(instance);

        // Execute some operations for code coverage
        calculator.add(123);
       
View Full Code Here

        MBeanServer mbeanServer = (MBeanServer) registry.getService(MBeanServer.class);
        ObjectNameBuilder objectNameBuilder = (ObjectNameBuilder) registry
                .getService(ObjectNameBuilder.class);
        ObjectName objectName = objectNameBuilder.createObjectName(logger.getName(), "logger");

        ObjectInstance instance = mbeanServer.getObjectInstance(objectName);
        assertNotNull(instance);

        registry.shutdown();
    }
View Full Code Here

     */
    public ObjectInstance registerMBean(Object obj, Class managementInterface, ObjectName objectName)
            throws InstanceAlreadyExistsException, MBeanRegistrationException,
            NotCompliantMBeanException
    {
        ObjectInstance instance = null;
        try
        {
            if (_log.isDebugEnabled())
            {
                _log.debug("Trying to register MBean " + objectName);
View Full Code Here

     * @see org.apache.hivemind.management.MBeanRegistry#unregisterMBean(javax.management.ObjectName)
     */
    public void unregisterMBean(ObjectName objectName) throws InstanceNotFoundException,
            MBeanRegistrationException
    {
        ObjectInstance instance = _beanServer.getObjectInstance(objectName);
        _objectInstances.remove(instance);
        _beanServer.unregisterMBean(objectName);
    }
View Full Code Here

    {
        // Unregister objects in reversed order. Otherwise the
        // Jsr 160 connector gets problems after the namingservice is unregistered
        for (int i = _objectInstances.size() - 1; i >= 0; i--)
        {
            ObjectInstance objectInstance = (ObjectInstance) _objectInstances.get(i);
            try
            {
                _beanServer.unregisterMBean(objectInstance.getObjectName());
            }
            catch (JMException e)
            {
                // Uncritical error, just warn
                _log.warn(ManagementMessages.errorUnregisteringMBean(
                        objectInstance.getObjectName(),
                        e));
            }
        }
    }
View Full Code Here

TOP

Related Classes of javax.management.ObjectInstance

Copyright © 2018 www.massapicom. 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.