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

David Beaumont duke at openjdk.org
Fri Feb 28 14:18:01 UTC 2025


On Fri, 28 Feb 2025 01:00:49 GMT, Stuart Marks <smarks at openjdk.org> wrote:

>> 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(). Also, since `@implSpec` adds a subhead and a new paragraph, the text that follows should have an initial capital letter.

Done.

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

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


More information about the core-libs-dev mailing list