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


Java Util.newObjectName方法代码示例

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


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

示例1: getDomains

import com.sun.jmx.mbeanserver.Util; //导入方法依赖的package包/类
public String[] getDomains()  {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        // Check if the caller has the right to invoke 'getDomains'
        //
        checkMBeanPermission((String) null, null, null, "getDomains");

        // Return domains
        //
        String[] domains = repository.getDomains();

        // Check if the caller has the right to invoke 'getDomains'
        // on each specific domain in the list.
        //
        List<String> result = new ArrayList<String>(domains.length);
        for (int i = 0; i < domains.length; i++) {
            try {
                ObjectName dom = Util.newObjectName(domains[i] + ":x=x");
                checkMBeanPermission((String) null, null, dom, "getDomains");
                result.add(domains[i]);
            } catch (SecurityException e) {
                // OK: Do not add this domain to the list
            }
        }

        // Make an array from result.
        //
        return result.toArray(new String[result.size()]);
    } else {
        return repository.getDomains();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:DefaultMBeanServerInterceptor.java

示例2: nonDefaultDomain

import com.sun.jmx.mbeanserver.Util; //导入方法依赖的package包/类
private ObjectName nonDefaultDomain(ObjectName name) {
    if (name == null || name.getDomain().length() > 0)
        return name;

    /* The ObjectName looks like ":a=b", and that's what its
       toString() will return in this implementation.  So
       we can just stick the default domain in front of it
       to get a non-default-domain name.  We depend on the
       fact that toString() works like that and that it
       leaves wildcards in place (so we can detect an error
       if one is supplied where it shouldn't be).  */
    final String completeName = domain + name;

    return Util.newObjectName(completeName);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:DefaultMBeanServerInterceptor.java

示例3: getInstance

import com.sun.jmx.mbeanserver.Util; //导入方法依赖的package包/类
/**
 * <p>Return an instance of ObjectName that can be used anywhere
 * the given object can be used.  The returned object may be of a
 * subclass of ObjectName.  If <code>name</code> is of a subclass
 * of ObjectName, it is not guaranteed that the returned object
 * will be of the same class.</p>
 *
 * <p>The returned value may or may not be identical to
 * <code>name</code>.  Calling this method twice with the same
 * parameters may return the same object or two equal but not
 * identical objects.</p>
 *
 * <p>Since ObjectName is immutable, it is not usually useful to
 * make a copy of an ObjectName.  The principal use of this method
 * is to guard against a malicious caller who might pass an
 * instance of a subclass with surprising behavior to sensitive
 * code.  Such code can call this method to obtain an ObjectName
 * that is known not to have surprising behavior.</p>
 *
 * @param name an instance of the ObjectName class or of a subclass
 *
 * @return an instance of ObjectName or a subclass that is known to
 * have the same semantics.  If <code>name</code> respects the
 * semantics of ObjectName, then the returned object is equal
 * (though not necessarily identical) to <code>name</code>.
 *
 * @exception NullPointerException The <code>name</code> is null.
 *
 */
public static ObjectName getInstance(ObjectName name) {
    if (name.getClass().equals(ObjectName.class))
        return name;
    return Util.newObjectName(name.getSerializedNameString());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:35,代码来源:ObjectName.java


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