On Wed, 27 Jan 2021 05:41:47 GMT, Yasumasa Suenaga <ysuen...@openjdk.org> wrote:
>> Hi Yasumasa, >> >> I thought the comments regarding the test were to use an if statement to >> check iter.hasNext() and return after seeing one Monitor, rather than >> keeping the while-loop and reporting every single Monitor found. The latter >> seems a waste of timer as we don't know how many Monitors to expect, so it >> adds no value to report them all. >> >> Cheers, >> David > >> I thought the comments regarding the test were to use an if statement to >> check iter.hasNext() and return after seeing one Monitor, rather than >> keeping the while-loop and reporting every single Monitor found. The latter >> seems a waste of timer as we don't know how many Monitors to expect, so it >> adds no value to report them all. > > I thought we should test whether we can get ObjectMonitor via SA at first - > in other words, the test would pass when we get 1 ObjectMonitor at least. > However all of information of ObjectMonitors might be useful for diagnostic > purposes as @dcubed-ojdk said. In this test, we use LingeredAppWithLock for > debugee, so it will not waste time to iterate. (we might estimate num of > locks we will observe: we can see 3 ObjectMonitors now) The number should be small. I typically see 2 or 3 depending on the java options. If I happen to see more, then that's a clue (to me anyway) that something has changed and might be amiss. ------------- PR: https://git.openjdk.java.net/jdk/pull/1910