当前位置: 首页>>代码示例>>Java>>正文


Java QueryEval.getMBeanServer方法代码示例

本文整理汇总了Java中javax.management.QueryEval.getMBeanServer方法的典型用法代码示例。如果您正苦于以下问题:Java QueryEval.getMBeanServer方法的具体用法?Java QueryEval.getMBeanServer怎么用?Java QueryEval.getMBeanServer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.management.QueryEval的用法示例。


在下文中一共展示了QueryEval.getMBeanServer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: queryMBeans

import javax.management.QueryEval; //导入方法依赖的package包/类
public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) {
    Set<ObjectInstance> instances = newSet();
    if (name == null)
        name = ObjectName.WILDCARD;
    if (query == null)
        query = trueQuery;
    MBeanServer oldMBS = QueryEval.getMBeanServer();
    try {
        query.setMBeanServer(this);
        for (ObjectName n : mbeans.keySet()) {
            if (name.apply(n)) {
                try {
                    if (query.apply(n))
                        instances.add(getObjectInstance(n));
                } catch (Exception e) {
                    // OK: Ignore this MBean in the result
                }
            }
        }
    } finally {
        query.setMBeanServer(oldMBS);
    }
    return instances;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:25,代码来源:OldMBeanServerTest.java

示例2: filterListOfObjectInstances

import javax.management.QueryEval; //导入方法依赖的package包/类
/**
 * Applies the specified queries to the set of ObjectInstances.
 */
private Set<ObjectInstance>
        filterListOfObjectInstances(Set<ObjectInstance> list,
                                    QueryExp query) {
    // Null query.
    //
    if (query == null) {
        return list;
    } else {
        Set<ObjectInstance> result = new HashSet<ObjectInstance>();
        // Access the filter.
        //
        for (ObjectInstance oi : list) {
            boolean res = false;
            MBeanServer oldServer = QueryEval.getMBeanServer();
            query.setMBeanServer(server);
            try {
                res = query.apply(oi.getObjectName());
            } catch (Exception e) {
                res = false;
            } finally {
                /*
                 * query.setMBeanServer is probably
                 * QueryEval.setMBeanServer so put back the old
                 * value.  Since that method uses a ThreadLocal
                 * variable, this code is only needed for the
                 * unusual case where the user creates a custom
                 * QueryExp that calls a nested query on another
                 * MBeanServer.
                 */
                query.setMBeanServer(oldServer);
            }
            if (res) {
                result.add(oi);
            }
        }
        return result;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:42,代码来源:DefaultMBeanServerInterceptor.java

示例3: setQueryExpServer

import javax.management.QueryEval; //导入方法依赖的package包/类
/**  Set the mbean server on the QueryExp and try and pass back any previously set one */
private static MBeanServer setQueryExpServer(QueryExp query, MBeanServer toSet) {
    // We assume the QueryExp is a QueryEval subclass or uses the QueryEval thread local
    // mechanism to store any existing MBeanServer. If that's not the case we have no
    // way to access the old mbeanserver to let us restore it
    MBeanServer result = QueryEval.getMBeanServer();
    query.setMBeanServer(toSet);
    return result;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:10,代码来源:ModelControllerMBeanHelper.java

示例4: apply

import javax.management.QueryEval; //导入方法依赖的package包/类
public boolean apply(final ObjectName name) {
    final MBeanServer mbs = QueryEval.getMBeanServer();
    return isInstanceOf(mbs, name, broadcasterClass);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:ArrayNotificationBuffer.java


注:本文中的javax.management.QueryEval.getMBeanServer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。