RFR: 8243455: Many SA tests can fail due to trying to get the stack trace of an active method

Yasumasa Suenaga ysuenaga at openjdk.java.net
Tue Mar 9 06:15:11 UTC 2021


On Tue, 9 Mar 2021 06:06:28 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> test/lib/jdk/test/lib/apps/LingeredApp.java line 531:
>> 
>>> 529:             // although this probably is not necessary to guarantee that the
>>> 530:             // stack trace is readable.
>>> 531:             Thread.sleep(100);
>> 
>> Can we wait to change the state of `steadyStateThread` to `BLOCKED`? It is more robustness than `Thread.sleep(100)`.
>
> How do you do that?

For example, can we write following code?

while (steadyStateThread.getState() != Thread.State.BLOCKED) {
    Thread.onSpinWait();
}

-------------

PR: https://git.openjdk.java.net/jdk/pull/2700


More information about the serviceability-dev mailing list