當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。