Search in sources :

Example 6 with IgniteStandardMXBean

use of org.apache.ignite.internal.mxbean.IgniteStandardMXBean in project ignite by apache.

the class GridMBeanSelfTest method testEmptyNameMBeanInfo.

/**
 * Tests correct MBean interface.
 *
 * @throws Exception Thrown if test fails.
 */
public void testEmptyNameMBeanInfo() throws Exception {
    try {
        StandardMBean mbean = new IgniteStandardMXBean(new GridMBeanImplementation(), GridMBeanInterfaceEmptyName.class);
        mbean.getMBeanInfo();
    } catch (AssertionError ignored) {
        return;
    }
    assert false;
}
Also used : StandardMBean(javax.management.StandardMBean) IgniteStandardMXBean(org.apache.ignite.internal.mxbean.IgniteStandardMXBean)

Example 7 with IgniteStandardMXBean

use of org.apache.ignite.internal.mxbean.IgniteStandardMXBean in project ignite by apache.

the class IgniteUtils method registerMBean.

/**
 * Registers MBean with the server.
 *
 * @param <T> Type of mbean.
 * @param mbeanSrv MBean server.
 * @param name MBean object name.
 * @param impl MBean implementation.
 * @param itf MBean interface.
 * @return JMX object name.
 * @throws MBeanRegistrationException if MBeans are disabled.
 * @throws JMException If MBean creation failed.
 * @throws IgniteException If MBean creation are not allowed.
 */
public static <T> ObjectName registerMBean(MBeanServer mbeanSrv, ObjectName name, T impl, Class<T> itf) throws JMException {
    if (IGNITE_MBEANS_DISABLED)
        throw new MBeanRegistrationException(new IgniteIllegalStateException("MBeans are disabled."));
    assert mbeanSrv != null;
    assert name != null;
    assert itf != null;
    DynamicMBean mbean = new IgniteStandardMXBean(impl, itf);
    mbean.getMBeanInfo();
    return mbeanSrv.registerMBean(mbean, name).getObjectName();
}
Also used : DynamicMBean(javax.management.DynamicMBean) IgniteStandardMXBean(org.apache.ignite.internal.mxbean.IgniteStandardMXBean) MBeanRegistrationException(javax.management.MBeanRegistrationException) IgniteIllegalStateException(org.apache.ignite.IgniteIllegalStateException)

Example 8 with IgniteStandardMXBean

use of org.apache.ignite.internal.mxbean.IgniteStandardMXBean in project ignite by apache.

the class GridMBeanSelfTest method testMissedNameMBeanInfo.

/**
 * Tests correct MBean interface.
 *
 * @throws Exception Thrown if test fails.
 */
public void testMissedNameMBeanInfo() throws Exception {
    try {
        StandardMBean mbean = new IgniteStandardMXBean(new GridMBeanImplementation(), GridMBeanInterfaceBad.class);
        mbean.getMBeanInfo();
    } catch (AssertionError ignored) {
        return;
    }
    assert false;
}
Also used : StandardMBean(javax.management.StandardMBean) IgniteStandardMXBean(org.apache.ignite.internal.mxbean.IgniteStandardMXBean)

Example 9 with IgniteStandardMXBean

use of org.apache.ignite.internal.mxbean.IgniteStandardMXBean in project ignite by apache.

the class GridMBeanSelfTest method testMissedDescriptionMBeanInfo.

/**
 * Tests correct MBean interface.
 *
 * @throws Exception Thrown if test fails.
 */
public void testMissedDescriptionMBeanInfo() throws Exception {
    try {
        StandardMBean mbean = new IgniteStandardMXBean(new GridMBeanImplementation(), GridMBeanInterfaceBadAgain.class);
        mbean.getMBeanInfo();
    } catch (AssertionError ignored) {
        return;
    }
    assert false;
}
Also used : StandardMBean(javax.management.StandardMBean) IgniteStandardMXBean(org.apache.ignite.internal.mxbean.IgniteStandardMXBean)

Aggregations

IgniteStandardMXBean (org.apache.ignite.internal.mxbean.IgniteStandardMXBean)9 StandardMBean (javax.management.StandardMBean)5 DynamicMBean (javax.management.DynamicMBean)3 MalformedURLException (java.net.MalformedURLException)1 CacheException (javax.cache.CacheException)1 CacheMXBean (javax.cache.management.CacheMXBean)1 CacheStatisticsMXBean (javax.cache.management.CacheStatisticsMXBean)1 MBeanAttributeInfo (javax.management.MBeanAttributeInfo)1 MBeanInfo (javax.management.MBeanInfo)1 MBeanOperationInfo (javax.management.MBeanOperationInfo)1 MBeanParameterInfo (javax.management.MBeanParameterInfo)1 MBeanRegistrationException (javax.management.MBeanRegistrationException)1 MBeanServer (javax.management.MBeanServer)1 MalformedObjectNameException (javax.management.MalformedObjectNameException)1 ObjectName (javax.management.ObjectName)1 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 IgniteIllegalStateException (org.apache.ignite.IgniteIllegalStateException)1