All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alachisoft.ncache.jsr107.NCacheMXBean Maven / Gradle / Ivy

There is a newer version: 5.3.0
Show newest version
package com.alachisoft.ncache.jsr107;

import com.alachisoft.ncache.common.caching.statistics.monitoring.CacheMonitor;


public class NCacheMXBean {

    protected NCacheCache jCache;
    private String name;

    /**
     * @param cache
     * @param name
     */
    public NCacheMXBean(NCacheCache cache, String name) {
        this.jCache = cache;
        this.name = name;
    }

    private String sanitize(String string) {
        return string == null ? "" : string.replaceAll(",|:|=|\n", ".");
    }

    String getObjectName() {
        String cacheManagerName = sanitize(jCache.getCacheManager().getURI().toString());
        String cacheName = sanitize(jCache.getName());

        return "javax.cache:type=Cache" + name + ",CacheManager="
                + cacheManagerName + ",Cache=" + cacheName;
    }

    CacheMonitor getTayzGrid() {
        return (CacheMonitor) jCache.unwrap(CacheMonitor.class);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy