當前位置: 首頁>>代碼示例>>Java>>正文


Java MBeanOperationInfo.getName方法代碼示例

本文整理匯總了Java中javax.management.MBeanOperationInfo.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java MBeanOperationInfo.getName方法的具體用法?Java MBeanOperationInfo.getName怎麽用?Java MBeanOperationInfo.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.management.MBeanOperationInfo的用法示例。


在下文中一共展示了MBeanOperationInfo.getName方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getOperationName

import javax.management.MBeanOperationInfo; //導入方法依賴的package包/類
public static final String getOperationName(MBeanOperationInfo info) {
    StringBuilder name = new StringBuilder(info.getName());
    name.append('(');

    MBeanParameterInfo[] parameterInfos = info.getSignature();

    if (parameterInfos != null) {

        int parameterCount = parameterInfos.length;
        for (int i = 0; i < parameterCount; i++) {
            MBeanParameterInfo parameterInfo = parameterInfos[i];
            String parameterType = getTypeName(parameterInfo.getType(), parameterInfo.getDescriptor());
            name.append(parameterType);

            if (i < parameterCount - 1) {
                name.append(", ");
            }
        }

    }

    name.append(')');
    return name.toString();
}
 
開發者ID:baloise,項目名稱:eZooKeeper,代碼行數:25,代碼來源:JmxUtils.java

示例2: getDescription

import javax.management.MBeanOperationInfo; //導入方法依賴的package包/類
@Override
protected String getDescription(final MBeanOperationInfo info) {
    switch (info.getName()) {
    case "sync":
        return "Synchronizes all file systems and eventually unmounts them.";
    default:
        return null;
    }
}
 
開發者ID:christian-schlichtherle,項目名稱:truevfs,代碼行數:10,代碼來源:JmxManagerView.java

示例3: getDescription

import javax.management.MBeanOperationInfo; //導入方法依賴的package包/類
@Override
protected String getDescription(final MBeanOperationInfo info) {
    switch (info.getName()) {
    case "sync":
        return "Synchronizes this file system and all enclosed file systems and eventually unmounts them.";
    default:
        return null;
    }
}
 
開發者ID:christian-schlichtherle,項目名稱:truevfs,代碼行數:10,代碼來源:JmxModelView.java

示例4: test

import javax.management.MBeanOperationInfo; //導入方法依賴的package包/類
private static void test(Object child, String name, boolean mxbean)
    throws Exception {
    final ObjectName childName =
            new ObjectName("test:type=Child,name="+name);
    final MBeanServer server =
            ManagementFactory.getPlatformMBeanServer();
    server.registerMBean(child,childName);
    try {
        final MBeanInfo info = server.getMBeanInfo(childName);
        System.out.println(name+": " + info.getDescriptor());
        final int len = info.getOperations().length;
        if (len == OPCOUNT) {
            System.out.println(name+": OK, only "+OPCOUNT+
                    " operations here...");
        } else {
            final String qual = (len>OPCOUNT)?"many":"few";
            System.err.println(name+": Too "+qual+" foos! Found "+
                    len+", expected "+OPCOUNT);
            for (MBeanOperationInfo op : info.getOperations()) {
                System.err.println("public "+op.getReturnType()+" "+
                        op.getName()+"();");
            }
            throw new RuntimeException("Too " + qual +
                    " foos for "+name);
        }

        final Descriptor d = info.getDescriptor();
        final String mxstr = String.valueOf(d.getFieldValue("mxbean"));
        final boolean mxb =
                (mxstr==null)?false:Boolean.valueOf(mxstr).booleanValue();
        System.out.println(name+": mxbean="+mxb);
        if (mxbean && !mxb)
            throw new AssertionError("MXBean is not OpenMBean?");

        for (MBeanOperationInfo mboi : info.getOperations()) {

            // Sanity check
            if (mxbean && !mboi.getName().equals("foo")) {
                // The spec doesn't guarantee that the MBeanOperationInfo
                // of an MXBean will be an OpenMBeanOperationInfo, and in
                // some circumstances in our implementation it will not.
                // However, in thsi tests, for all methods but foo(),
                // it should.
                //
                if (!(mboi instanceof OpenMBeanOperationInfo))
                    throw new AssertionError("Operation "+mboi.getName()+
                            "() is not Open?");
            }

            final String exp = EXPECTED_TYPES.get(mboi.getName());

            // For MXBeans, we need to compare 'exp' with the original
            // type - because mboi.getReturnType() returns the OpenType
            //
            String type = (String)mboi.getDescriptor().
                        getFieldValue("originalType");
            if (type == null) type = mboi.getReturnType();
            if (type.equals(exp)) continue;
            System.err.println("Bad return type for "+
                    mboi.getName()+"! Found "+type+
                    ", expected "+exp);
            throw new RuntimeException("Bad return type for "+
                    mboi.getName());
        }
    } finally {
        server.unregisterMBean(childName);
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:69,代碼來源:TooManyFooTest.java


注:本文中的javax.management.MBeanOperationInfo.getName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。