Codereview: JDK-8065764 javax/management/monitor/CounterMonitorTest.java hangs

shanliang shanliang.jiang at oracle.com
Mon Dec 1 13:50:16 UTC 2014


Hi,
please review this test bug fix:

webrev:
http://cr.openjdk.java.net/~sjiang/JDK-8065764/00/

bug:
https://bugs.openjdk.java.net/browse/JDK-8065764

The test tested the mode "difference", according to the Javadoc:
      If the counter difference mode is used, the value of the derived 
gauge is calculated as the difference between the observed counter 
values for two successive observations.

The test set the first value and then waited 2 times of 
granularityperiod at line 171, hoped that the monitor would get the 
first observation during this waiting time, but the test could fail 
because granularityperiod * 2 was not enough and the test did the second 
set before the monitor did the first observation.

It is easy to make the test timeout by commenting out the line 171.

The proposed solution is to get informed when the monitor did 
observation on calling:
    StdObservedObject.getNbObjects();

Thanks,
Shanliang




More information about the serviceability-dev mailing list