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


Java ThreadInfo.from方法代码示例

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


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

示例1: badNameCompositeData

import java.lang.management.ThreadInfo; //导入方法依赖的package包/类
public static void badNameCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for ThreadInfo",
                          badItemNames,
                          badItemNames,
                          validItemTypes);
    CompositeData cd =
        new CompositeDataSupport(ct,
                                 badItemNames,
                                 values);

    try {
        ThreadInfo info = ThreadInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:ThreadInfoCompositeData.java

示例2: createV5ThreadInfo

import java.lang.management.ThreadInfo; //导入方法依赖的package包/类
public static void createV5ThreadInfo() throws Exception {
     String[] v5ItemNames = new String[NUM_V5_ATTS];
     OpenType[] v5ItemTypes = new OpenType[NUM_V5_ATTS];
     Object[] v5ItemValues = new Object[NUM_V5_ATTS];
     for (int i = 0; i < NUM_V5_ATTS; i++) {
         v5ItemNames[i] = validItemNames[i];
         v5ItemTypes[i] = validItemTypes[i];
         v5ItemValues[i] = values[i];
     }
     CompositeType ct =
         new CompositeType("MyCompositeType",
                           "CompositeType for JDK 5.0 ThreadInfo",
                           v5ItemNames,
                           v5ItemNames,
                           v5ItemTypes);
     CompositeData cd =
         new CompositeDataSupport(ct,
                                  v5ItemNames,
                                  v5ItemValues);
     ThreadInfo info = ThreadInfo.from(cd);
     checkThreadInfo(info);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:ThreadInfoCompositeData.java

示例3: badTypeCompositeData

import java.lang.management.ThreadInfo; //导入方法依赖的package包/类
public static void badTypeCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for ThreadInfo",
                          validItemNames,
                          validItemNames,
                          badItemTypes);

    // patch values[STACK_TRACE] to Long
    values[STACK_TRACE] = new Long(1000);
    values[LOCK_INFO] = new Long(1000);
    CompositeData cd =
        new CompositeDataSupport(ct,
                                 validItemNames,
                                 values);

    try {
        ThreadInfo info = ThreadInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:ThreadInfoCompositeData.java

示例4: getThreads

import java.lang.management.ThreadInfo; //导入方法依赖的package包/类
public ThreadInfo[] getThreads() {
    synchronized (tinfoLock) {
        if (tinfos == null) {
            int i = 0;
            tinfos = new ThreadInfo[cdThreads.length];
            for (Object cd : cdThreads) {
                tinfos[i++] = ThreadInfo.from((CompositeData) cd);
            }
            cdThreads = null;
        }
        return tinfos;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ThreadDump.java

示例5: addStacktrace

import java.lang.management.ThreadInfo; //导入方法依赖的package包/类
private void addStacktrace(java.lang.management.ThreadInfo[] tinfos, long time) {
    java.lang.management.ThreadInfo[] newInfo = new java.lang.management.ThreadInfo[tinfos.length];
    int i = 0;

    for (java.lang.management.ThreadInfo tinfo : tinfos) {
        CompositeData aaa = ThreadInfoCompositeData.toCompositeData(tinfo);
        newInfo[i++] = ThreadInfo.from(aaa);
    }
    instance.addStacktrace(newInfo, time);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:StackTraceSnapshotBuilderTest.java

示例6: createGoodCompositeData

import java.lang.management.ThreadInfo; //导入方法依赖的package包/类
public static void createGoodCompositeData() throws Exception {
     CompositeType ct =
         new CompositeType("MyCompositeType",
                           "CompositeType for ThreadInfo",
                           validItemNames,
                           validItemNames,
                           validItemTypes);
     CompositeData cd =
         new CompositeDataSupport(ct,
                                  validItemNames,
                                  values);
     ThreadInfo info = ThreadInfo.from(cd);
     checkThreadInfo(info);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:15,代码来源:ThreadInfoCompositeData.java


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