RFR: JDK-6823527: java.util.logging.Handler has thread safety issues

Daniel Fuchs daniel.fuchs at oracle.com
Thu Aug 29 10:42:26 UTC 2013


This is a fix for an old bug which rightfully remarks that
whereas access to 'level' in handler is synchronized,
access to other mutable fields - like 'filter' etc...
is not - which is inconsistent.


I have tried to keep the fix simple - simply adding
synchronized to method declarations when it was clear that
there was an inconsistency.

I also looked at the subclasses of j.u.l.Handler

In some places I resorted to using a synchronized block to avoid
calling overridable / external method from within the lock.

The changed methods are simple accessors, and subclasses of
Handler are already full of synchronized methods (e.g.
methods like publish(...) are already synchronized)
so the risk of fixing these simple accessors should be limited.

best regards,

-- daniel

More information about the core-libs-dev mailing list