On Wed, 23 Nov 2022 15:22:47 GMT, Roger Riggs <[email protected]> wrote:
>> src/java.base/share/classes/jdk/internal/misc/InnocuousThread.java line 137:
>>
>>> 135: public static Thread newSystemThread(String name, Runnable target,
>>> 136: long stackSize, int priority,
>>> 137: boolean daemon) {
>>
>> Thanks for adding this overload, I think that it will be useful for the
>> future too. ( it never seems to matter how many variants of these
>> factories we have, we still need one more :-) )
>
> I would prefer to to avoid creating new factories when the desired function
> can be done on the resulting thread.
> Such as `setDaemon()` and `setName()`, etc.
> It does avoid the doPriv in this case, but is not necessary and when the
> security manager goes away, will leave around clutter (duplicated)
> functionality.
Looking beyond this specific change, there is a lot of potential use for this
new factory elsewhere in the code. It also avoids similar bugs from possibly
reoccurring (by having the setDaemon call inside the factory).
-------------
PR: https://git.openjdk.org/jdk/pull/11309