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


Java MalformedObjectNameException.getMessage方法代码示例

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


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

示例1: addNotificationListener

import javax.management.MalformedObjectNameException; //导入方法依赖的package包/类
public Integer addNotificationListener(final ObjectName name,
    final NotificationFilter filter)
    throws InstanceNotFoundException, IOException {

    if (logger.traceOn()) {
        logger.trace("addNotificationListener",
            "Add a listener at " + name);
    }

    checkState();

    // Explicitly check MBeanPermission for addNotificationListener
    //
    checkMBeanPermission(name, "addNotificationListener");
    if (notificationAccessController != null) {
        notificationAccessController.addNotificationListener(
            connectionId, name, getSubject());
    }
    try {
        boolean instanceOf =
        AccessController.doPrivileged(
                new PrivilegedExceptionAction<Boolean>() {
                    public Boolean run() throws InstanceNotFoundException {
                        return mbeanServer.isInstanceOf(name, broadcasterClass);
                    }
        });
        if (!instanceOf) {
            throw new IllegalArgumentException("The specified MBean [" +
                name + "] is not a " +
                "NotificationBroadcaster " +
                "object.");
        }
    } catch (PrivilegedActionException e) {
        throw (InstanceNotFoundException) extractException(e);
    }

    final Integer id = getListenerID();

    // 6238731: set the default domain if no domain is set.
    ObjectName nn = name;
    if (name.getDomain() == null || name.getDomain().equals("")) {
        try {
            nn = ObjectName.getInstance(mbeanServer.getDefaultDomain(),
                                        name.getKeyPropertyList());
        } catch (MalformedObjectNameException mfoe) {
            // impossible, but...
            IOException ioe = new IOException(mfoe.getMessage());
            ioe.initCause(mfoe);
            throw ioe;
        }
    }

    synchronized (listenerMap) {
        IdAndFilter idaf = new IdAndFilter(id, filter);
        Set<IdAndFilter> set = listenerMap.get(nn);
        // Tread carefully because if set.size() == 1 it may be the
        // Collections.singleton we make here, which is unmodifiable.
        if (set == null)
            set = Collections.singleton(idaf);
        else {
            if (set.size() == 1)
                set = new HashSet<IdAndFilter>(set);
            set.add(idaf);
        }
        listenerMap.put(nn, set);
    }

    return id;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:70,代码来源:ServerNotifForwarder.java


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