RFR: 8265153: add time based test for ThreadMXBean.getThreadInfo() and ThreadInfo.getLockOwnerName() [v5]

Daniel D.Daugherty dcubed at openjdk.java.net
Fri May 14 23:58:04 UTC 2021


On Fri, 14 May 2021 22:41:28 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> It's a grammar notational style from my compiler theory days.
>> I've used '::=' and ':=' for years. What would you like it changed to?
>> Or can I just leave it and try to use '-' in the future?
>
> The convention for java tools seems to be to just use tabs to align the start of the argument descriptions:
> 
> 
>    -p          print debug info
>    time_max    max looping time in seconds

Fixed.

>> This new test is a variation of a 20 year old test that I recently ported to JVM/TI
>> and integrated. 20 years ago, it was much simpler to write the test this way.
>> I could create a separate Thread subclass for each "role", but I'd rather not
>> do that since it will no longer be easy to compare this test to its siblings.
>> 
>> As for lambdas, I know absolutely zero about writing lambda code.
>
> Ok. I get it about lambdas, but they can be useful for simplifying thread tasks without creating a subclass. Here are a few examples, but no need for you to replicate any them:
> 
> 
>     // create thread with specified method as the "run" method
>     Thread t = new Thread(this::testMethod);
>     t.start();
> 
> 
> 
>     // create thread with the specified code block as the "run" method
>     Thread t1 = new Thread(() -> {
>         synchronized (lock1) {
>             System.out.println("Thread in sync section 1: "
>                     + Thread.currentThread().getName());
>             test1();
>         }
> 
> 
> 
>     // create a static Runnable object using a lambda and use it as the Runnable for a new Thread
>     static final Runnable CONSUMER = () -> {
>         remove(QUEUE);
>     };
>     ...
>     Thread t = new Thread(CONSUMER);

I'll pass on the lambdas.

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

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


More information about the hotspot-runtime-dev mailing list