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

Alan Bateman alanb at openjdk.org
Thu Dec 12 07:37:39 UTC 2024


On Thu, 12 Dec 2024 02:33:30 GMT, Brian Burkhalter <bpb 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.

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.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22697#discussion_r1881522808
PR Review Comment: https://git.openjdk.org/jdk/pull/22697#discussion_r1881520211


More information about the nio-dev mailing list