On Tue, 18 Apr 2023 05:59:56 GMT, Alan Bateman <[email protected]> wrote:
>> 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).
I've updated it to reuse thread factory and don't check exceptions.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13432#discussion_r1170148956