RFR: 8340830: Console.readLine() and Console.printf() are mutually blocking [v4]

Volkan Yazici vyazici at openjdk.org
Mon Feb 2 21:43:57 UTC 2026


On Mon, 2 Feb 2026 20:56:17 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> Fixing an issue in Console where write is blocked if other thread is waiting to read, which is caused by unnecessary read/write locks. Removing those would solve the problem, as the read/write synchronization is performed at the StreamEn/Decoder level. One unrelated change is to refactor double-checked locking with LazyConstant.
>
> Naoto Sato has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:
> 
>  - added jline test run
>  - Merge branch 'master' into JDK-8340830-Console-readLine-printf-mutually-blocking
>  - Fixed indentation
>  - Made ProxyingConsole value-based, used anonymous class for LazyConstant
>  - Refine exceptions
>  - initial commit

test/jdk/java/io/Console/ReadWriteBlockingTest.java line 47:

> 45: 
> 46:     @Test
> 47:     @EnabledOnOs({OS.LINUX, OS.MAC})

You might want to tell this to JTreg and avoid some CPU cycles:

    @requires (os.family == "linux" | os.family == "mac")

`@EnabledOnOs` can receive a `disabledReason` argument, which might be handy in this case.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29493#discussion_r2756205116


More information about the core-libs-dev mailing list