[slf4j-dev] [Bug 298] locks around logger maps inhibit concurrency
bugzilla-daemon at qos.ch
bugzilla-daemon at qos.ch
Sun Mar 24 17:24:06 CET 2013
http://bugzilla.slf4j.org/show_bug.cgi?id=298
--- Comment #1 from Taras Tielkes <taras.tielkes at gmail.com> 2013-03-24 17:24:06 CET ---
Created attachment 92
--> http://bugzilla.slf4j.org/attachment.cgi?id=92
Proposed patch, using ConcurrentHashMap for logger caching/retrieval
Initial proposed patch attached.
More detailed description:
* Adapted the components using a lock-guarded look-up logger map to use a
Java5+ ConcurrentHashMap. This should result in a lock-free code path for the
typical case where a logger is already cached, and a lock on just a single CHM
segment for the putIfAbsent() call
* The adapted code uses the ConcurrentMap.putIfAbsent() method to ensure that
the same logger instance is returned, even if two threads concurrently query
for the same logger
I've tried to keep changes as limited as possible. While the usages of
ConcurrentHashMap implies Java 5+, I did not adjust the code to use generics.
--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the slf4j-dev
mailing list