DefaultMBeanServerInterceptor.java 文件源码

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

项目:openjdk-jdk10 作者:
public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        // Check if the caller has the right to invoke 'queryMBeans'
        //
        checkMBeanPermission((String) null, null, null, "queryMBeans");

        // Perform query without "query".
        //
        Set<ObjectInstance> list = queryMBeansImpl(name, null);

        // Check if the caller has the right to invoke 'queryMBeans'
        // on each specific classname/objectname in the list.
        //
        Set<ObjectInstance> allowedList =
            new HashSet<ObjectInstance>(list.size());
        for (ObjectInstance oi : list) {
            try {
                checkMBeanPermission(oi.getClassName(), null,
                                     oi.getObjectName(), "queryMBeans");
                allowedList.add(oi);
            } catch (SecurityException e) {
                // OK: Do not add this ObjectInstance to the list
            }
        }

        // Apply query to allowed MBeans only.
        //
        return filterListOfObjectInstances(allowedList, query);
    } else {
        // Perform query.
        //
        return queryMBeansImpl(name, query);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号