Statistics.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:oceandata 作者:
@Override
public MBeanInfo getMBeanInfo() {
    try {
        Class<?> cls = this.getClass();
        Constructor<?> constructor = cls.getConstructor(new Class[] {});
        Method readConnectionsRequested = cls.getMethod("readConnectionsRequested", new Class[]{});
        Method readConnectionsRelease = cls.getMethod("readConnectionsRelease", new Class[]{});
        Method readCacheInts = cls.getMethod("readCacheInts", new Class[]{});
        Method readCacheMiss = cls.getMethod("readCacheMiss", new Class[]{});
        MBeanAttributeInfo connectionsRequested = new MBeanAttributeInfo("connections requested", "connections requested", readConnectionsRequested, null);
        MBeanAttributeInfo connectionsRelease = new MBeanAttributeInfo("Connections Release", "Connections Release", readConnectionsRelease, null);
        MBeanAttributeInfo cacheInts = new MBeanAttributeInfo("cache ints", "cache ints", readCacheInts, null);
        MBeanAttributeInfo cacheMiss = new MBeanAttributeInfo("Cache Miss", "Cache Miss", readCacheMiss, null);
        MBeanConstructorInfo mBeanConstructorInfo = new MBeanConstructorInfo("Constructor for Statistics", constructor);
        MBeanInfo mBeanInfo = new MBeanInfo(cls.getName(), "Monitor that controls the server", new MBeanAttributeInfo[] { connectionsRequested, connectionsRelease, cacheInts, cacheMiss }, new MBeanConstructorInfo[] {mBeanConstructorInfo}, null, null);
        return mBeanInfo;
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号