On Tue, 18 Apr 2023 05:30:47 GMT, Jaikiran Pai <[email protected]> wrote:
>> The plugin which support execution of test's main method in separate virtual
>> thread is added.
>> The plugin is built as a part of test image and might be used in testing by
>> adding JTREG_TEST_THREAD_FACTORY=Virtual option.
>
> test/jtreg_test_thread_factory/src/share/classes/Virtual.java line 46:
>
>> 44: public Thread newThread(Runnable task) {
>> 45: try {
>> 46: return Thread.ofVirtual().factory().newThread(task);
>
> As far as I can see, none of these method calls throw a checked exception.
> Should we perhaps remove this try/catch block and let any runtime exception
> that gets thrown be propagated as-is instead of wrapping it in a
> `RuntimException`?
It's also a bit strange that it creates a new ThreadFactory each time, I had
expected to be a wrapper around one ThreadFactory. The effect is the same, just
a bit strange.
(I suspect the try-catch dates from when it called Thread.ofVirtual with
reflection).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13432#discussion_r1169530229