RFR: 8349206: j.u.l.Handler classes create deadlock risk via synchronized publish() method [v6]

Stuart Marks smarks at openjdk.org
Fri Feb 28 01:04:02 UTC 2025


On Tue, 25 Feb 2025 01:21:40 GMT, Stuart Marks <smarks at openjdk.org> wrote:

>> David Beaumont has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Tweaking @implNote for better rendering.
>
> src/java.logging/share/classes/java/util/logging/StreamHandler.java line 184:
> 
>> 182:      *
>> 183:      * @param  record  description of the log event. A null record is
>> 184:      *                 silently ignored and is not published
> 
> There needs to be an `@implSpec` somewhere in this method's javadoc comment that explains the locking policy here very crisply for subclassers. Specifically (1) the lock on `this` is not held during formatting; (2) the lock on `this` is held during publishing; (3) subclassers must not lock on `this` while calling super.publish() because it would contravene (1).

OK, this change is good. The only thing I'd say is that subclasses must not override publish() with a synchronized method AND ALSO call super.publish().

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23491#discussion_r1974575569


More information about the core-libs-dev mailing list