RFR: 8345432: (ch, fs) Replace anonymous Thread with InnocuousThread

Brian Burkhalter bpb at openjdk.org
Thu Dec 12 16:33:38 UTC 2024


On Thu, 12 Dec 2024 07:35:19 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Change internal instances of anonymous `Thread`s to instances of `InnocuousThread`.
>
> src/java.base/share/classes/sun/nio/ch/ThreadPool.java line 73:
> 
>> 71:     static ThreadFactory defaultThreadFactory() {
>> 72:         return (Runnable r) -> {
>> 73:             Thread t = InnocuousThread.newThread(r);
> 
> This change is observable as the threads in this thread pool execute user code. I can't imagine anything really wanting to rely on the undocumented inheritance but it's possible so we'll need to create a CSR for this.

Okay, I will create a CSR.

> src/java.base/share/classes/sun/nio/fs/Cancellable.java line 121:
> 
>> 119:      */
>> 120:     static void runInterruptibly(Cancellable task) throws ExecutionException {
>> 121:         Thread t = InnocuousThread.newThread("NIO-Task", task);
> 
> "NIO-Task" doesn't make sense as the thread name here, something like "CancellableOp" is closer to what it really is.
> 
> As you are there, the javadoc link to runInterruptibly is missing the "#", maybe we can fix this while we are here.

I just left the name as it was but will change it as suggested and fix the link.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22697#discussion_r1882486273
PR Review Comment: https://git.openjdk.org/jdk/pull/22697#discussion_r1882485695


More information about the nio-dev mailing list