Search in sources :

Example 1 with CacheStatisticsMXBean

use of javax.cache.management.CacheStatisticsMXBean in project ignite by apache.

the class CacheManager method registerCacheObject.

/**
 * @param mxbean MXBean.
 * @param name Cache name.
 * @param beanType Bean type.
 */
private void registerCacheObject(Object mxbean, String name, String beanType) {
    MBeanServer mBeanSrv = ignite.configuration().getMBeanServer();
    ObjectName registeredObjName = getObjectName(name, beanType);
    try {
        if (mBeanSrv.queryNames(registeredObjName, null).isEmpty()) {
            IgniteStandardMXBean bean = beanType.equals(CACHE_CONFIGURATION) ? new IgniteStandardMXBean((CacheMXBean) mxbean, CacheMXBean.class) : new IgniteStandardMXBean((CacheStatisticsMXBean) mxbean, CacheStatisticsMXBean.class);
            mBeanSrv.registerMBean(bean, registeredObjName);
        }
    } catch (Exception e) {
        throw new CacheException("Failed to register MBean: " + registeredObjName, e);
    }
}
Also used : CacheStatisticsMXBean(javax.cache.management.CacheStatisticsMXBean) CacheException(javax.cache.CacheException) IgniteStandardMXBean(org.apache.ignite.internal.mxbean.IgniteStandardMXBean) CacheMXBean(javax.cache.management.CacheMXBean) CacheException(javax.cache.CacheException) MalformedURLException(java.net.MalformedURLException) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) MalformedObjectNameException(javax.management.MalformedObjectNameException) MBeanServer(javax.management.MBeanServer) ObjectName(javax.management.ObjectName)

Aggregations

MalformedURLException (java.net.MalformedURLException)1 CacheException (javax.cache.CacheException)1 CacheMXBean (javax.cache.management.CacheMXBean)1 CacheStatisticsMXBean (javax.cache.management.CacheStatisticsMXBean)1 MBeanServer (javax.management.MBeanServer)1 MalformedObjectNameException (javax.management.MalformedObjectNameException)1 ObjectName (javax.management.ObjectName)1 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 IgniteStandardMXBean (org.apache.ignite.internal.mxbean.IgniteStandardMXBean)1