RFR: 8284930: Re-examine FilterInputStream mark/reset [v2]
Stuart Marks
smarks at openjdk.java.net
Thu Apr 21 00:04:25 UTC 2022
On Wed, 20 Apr 2022 15:33:26 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Remove the `synchronized` keyword from the `mark(int)` and `reset()` methods of `java.io.FilterInputStream`.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 8284930: Also remove synchronized keyword from mark() and reset() of InputStream
I think it's a vanishingly small possibility that anything is relying on the synchronization in these methods. Synchronization here would provide proper memory visibility effects across threads. To use input streams from multiple threads without interleaving operations, one would have to provide some other means of coordination among those threads, which itself would likely ensure proper memory visibility. I'm hard pressed to see how threads could coordinate solely via use of the `mark` and `reset` methods. Therefore, I think it's safe to remove synchronization from them.
This reasoning also applies to `InputStream`. Perhaps synchronization can be removed from there too.
I agree that a CSR is probably warranted to capture the behavior change and analysis.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8309
More information about the core-libs-dev
mailing list