RFR: 8259008: ArithmeticException was thrown at "Monitor Cache Dump" on HSDB [v4]
Chris Plummer
cjplummer at openjdk.java.net
Tue Jan 26 07:57:48 UTC 2021
On Tue, 26 Jan 2021 07:44:19 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:
>> Yasumasa Suenaga has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains seven commits:
>>
>> - Update comments for ObjectMonitorIterator
>> - Merge remote-tracking branch 'upstream/master' into JDK-8259008
>> - Update copyright year
>> - Remove unused code
>> - Fix comments
>> - Merge
>> - 8259008: ArithmeticException was thrown at "Monitor Cache Dump" on HSDB
>
> Hi Yasumasa,
>
> It looks good to me.
> I have one minor question.
>
> This loop in the test is a little bit confusing as it has not more than one iteration:
> 55 while (itr.hasNext()) {
> 56 ObjectMonitor mon = (ObjectMonitor)itr.next();
> 57 Oop oop = heap.newOop(mon.object());
> 58 System.out.println("Monitor found: " + oop.getKlass().getName().asString());
> 59 return;
> 60 }
> Would it better to replace it with if-statement?
>
> Thanks,
> Serguei
I'd say that's a bug, and probably what was meant is to do a `println` for every monitor found, not just the first one. So what you would want then is to bracket the `while` loop with `if (itr.hasNext()) {` and move the `return` outside the `while` loop but still inside the `if` block.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1910
More information about the serviceability-dev
mailing list