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

David Holmes david.holmes at oracle.com
Sat Aug 31 12:05:16 UTC 2013

On 31/08/2013 3:04 AM, Jason Mehrens wrote:
> The coarse grain locking in FileHandler, MemoryHandler, SocketHandler, and StreamHandler publish could/should be relaxed so we are not calling isLoggable while holding the lock.

I'm not sure I'd agree with that. If you moved isLoggable outside the 
sync region you could get inconsistent logging results if the log level 
is changed after the check - eg thread A is logging while the level is 
'high' and has checked isLoggable and it returned true and it gets 
preempted. Thread B changes the log level and adds a record to the log 
indicating that. Thread A then continues and you appear to get a "wrong" 
log entry.

Anyway definitely a future RFE not something to be modified for this issue.


> Jason
>> Date: Fri, 30 Aug 2013 13:50:56 +0200
>> From: daniel.fuchs at oracle.com
>> To: david.holmes at oracle.com
>> Subject: Re: RFR: JDK-6823527: java.util.logging.Handler has thread safety	issues
>> CC: core-libs-dev at openjdk.java.net
>> Hi,
>> Please find below an updated patch for solution (c)
>> <http://cr.openjdk.java.net/~dfuchs/webrev_6823527/webrev.02/>
>> best regards,
>> -- daniel

More information about the core-libs-dev mailing list