<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt><tt>I assume it's a simple ThreadInfo then a simple text form
        would work; if not, y</tt>ou can use the format NB use if you
      have the reader.<br>
      <br>
      Mandy<br>
    </tt><br>
    <div class="moz-cite-prefix">On 10/22/18 7:53 AM, Sven Reimers
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAP+Jvx7qUDxG6xu2s=3ax6xGvCuKBgr7WegmSfS1KoBzt_X5jw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <div dir="auto">
        <div>Hi Mandy,
          <div dir="auto">will try to get a sample to you.</div>
          <div dir="auto"><br>
          </div>
          <div dir="auto">Which format do you prefer?</div>
          <div dir="auto"><br>
          </div>
          <div dir="auto">Thanks for helping</div>
          <div dir="auto"><br>
          </div>
          <div dir="auto">-Sven</div>
          <br>
          <br>
          <div class="gmail_quote">
            <div dir="ltr">Mandy Chung <<a
                href="mailto:mandy.chung@oracle.com"
                moz-do-not-send="true">mandy.chung@oracle.com</a>>
              schrieb am So., 21. Okt. 2018, 23:26:<br>
            </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000"> Hi Sven,<br>
                <br>
                Do you have a sample ThreadInfo to reproduce this issue?
                  That will be helpful.  JMX monitoring is not impacted
                as far as I can tell.  NB profiling is using this
                internal API
                `sun.management.ThreadInfoCompositeData::toCompositeData`
                which may be unused since JMX supports MXBean.<br>
                <br>
                Mandy<br>
                <br>
                <div class="m_-2078486511437572800moz-cite-prefix">On
                  10/21/18 5:38 PM, Sven Reimers wrote:<br>
                </div>
                <blockquote type="cite">
                  <div dir="ltr">
                    <div dir="ltr">
                      <div dir="ltr">
                        <div>Hi,</div>
                        <div><br>
                        </div>
                        <div>one more problem to go</div>
                        <div><br>
                        </div>
                        <div>
                          <div>After applying the proposed fix for the
                            ThreadINfoCompositeData.compositeTyoe() the
                            following exception is raised:</div>
                          <div><br>
                          </div>
                          <div>java.lang.reflect.InvocationTargetException<br>
                          </div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
                            Method)</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
java.base/java.lang.reflect.Method.invoke(Method.java:566)</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
org.netbeans.modules.sampler.SamplesOutputStream.toCompositeData(SamplesOutputStream.java:178)</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
org.netbeans.modules.sampler.SamplesOutputStream.access$400(SamplesOutputStream.java:44)</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
org.netbeans.modules.sampler.SamplesOutputStream$Sample.writeToStream(SamplesOutputStream.java:285)</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
org.netbeans.modules.sampler.SamplesOutputStream$Sample.access$300(SamplesOutputStream.java:253)</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
org.netbeans.modules.sampler.SamplesOutputStream.close(SamplesOutputStream.java:202)</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
org.netbeans.modules.sampler.Sampler.stopSampling(Sampler.java:231)</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
org.netbeans.modules.sampler.Sampler.stop(Sampler.java:207)</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
org.netbeans.core.ui.sampler.SelfSamplerAction$1.doInBackground(SelfSamplerAction.java:90)</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
java.desktop/javax.swing.SwingWorker$1.call(SwingWorker.java:304)</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
java.desktop/javax.swing.SwingWorker.run(SwingWorker.java:343)</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
java.base/java.lang.Thread.run(Thread.java:835)</div>
                          <div>Caused by: java.lang.AssertionError:
                            javax.management.openmbean.OpenDataException:
                            Argument value of wrong type for item
                            lockInfo: value false, type
javax.management.openmbean.CompositeType(name=java.lang.management.LockInfo,items=((itemName=className,itemType=javax.management.openmbean.SimpleType(name=java.lang.String)),(itemName=identityHashCode,itemType=javax.management.openmbean.SimpleType(name=java.lang.Integer))))</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
java.management/sun.management.ThreadInfoCompositeData.getCompositeData(ThreadInfoCompositeData.java:135)</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
java.management/sun.management.ThreadInfoCompositeData.toCompositeData(ThreadInfoCompositeData.java:72)</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>...
                            18 more</div>
                          <div>Caused by:
                            javax.management.openmbean.OpenDataException:
                            Argument value of wrong type for item
                            lockInfo: value false, type
javax.management.openmbean.CompositeType(name=java.lang.management.LockInfo,items=((itemName=className,itemType=javax.management.openmbean.SimpleType(name=java.lang.String)),(itemName=identityHashCode,itemType=javax.management.openmbean.SimpleType(name=java.lang.Integer))))</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
java.management/javax.management.openmbean.CompositeDataSupport.<init>(CompositeDataSupport.java:235)</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
java.management/javax.management.openmbean.CompositeDataSupport.<init>(CompositeDataSupport.java:118)</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>at
java.management/sun.management.ThreadInfoCompositeData.getCompositeData(ThreadInfoCompositeData.java:130)</div>
                          <div><span class="m_-2078486511437572800gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>...
                            19 more</div>
                          <div><br>
                          </div>
                          <div>Seems the sequence of values is broken
                            for ThreadInfoCompoositeData also.<br>
                          </div>
                        </div>
                        <div><br>
                        </div>
                        <div>Changing the sequence so that lockInfoData
                          is after isNative fixes the problem: </div>
                        <div><br>
                        </div>
                        <div>       final Object[] threadInfoItemValues
                          = {</div>
                        <div>            threadInfo.getThreadId(),</div>
                        <div>            threadInfo.getThreadName(),</div>
                        <div>           
                          threadInfo.getThreadState().name(),</div>
                        <div>            threadInfo.getBlockedTime(),</div>
                        <div>            threadInfo.getBlockedCount(),</div>
                        <div>            threadInfo.getWaitedTime(),</div>
                        <div>            threadInfo.getWaitedCount(),</div>
                        <div>            threadInfo.getLockName(),</div>
                        <div>            threadInfo.getLockOwnerId(),</div>
                        <div>            threadInfo.getLockOwnerName(),</div>
                        <div>            stackTraceData,</div>
                        <div>            threadInfo.isSuspended(),</div>
                        <div>            threadInfo.isInNative(),</div>
                        <div>            lockInfoData,</div>
                        <div>            lockedMonitorsData,</div>
                        <div>            lockedSyncsData,</div>
                        <div>            threadInfo.isDaemon(),</div>
                        <div>            threadInfo.getPriority(),</div>
                        <div>        };</div>
                        <div><br>
                        </div>
                        <div>With both of this fixes in place I can
                          finally get the self sampling in NetBeans to
                          work on JDK 12.. (and 11)</div>
                        <div><br>
                        </div>
                        <div>Thanks for looking into this</div>
                        <div><br>
                        </div>
                        <div>-Sven</div>
                        -- <br>
                        <div dir="ltr"
                          class="m_-2078486511437572800gmail_signature">
                          <div dir="ltr">
                            <div>
                              <div dir="ltr">
                                <div dir="ltr">
                                  <div>Sven Reimers<br>
                                    <br>
                                    * Senior Expert Software Architect</div>
                                  <div>* Java Champion</div>
                                  <div>* JUG Leader JUG Bodensee: <a
                                      href="http://www.jug-bodensee.de"
                                      target="_blank" rel="noreferrer"
                                      moz-do-not-send="true">http://www.jug-bodensee.de</a><br>
                                  </div>
                                  <div>* Duke's Choice Award Winner 2009<br>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </blockquote>
                <br>
              </div>
            </blockquote>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>