logging package improvments
Guy Korland
gkorland at gmail.com
Sat Dec 22 22:47:42 UTC 2007
Hi,
It seems like there are few trivial improvement but critical for the logger
performance.
I think it's about time to refactor the module.
e.g.:
**
*1. LogRecord (line 147-148):*
*synchronized* (LogRecord.*class*) {
sequenceNumber = globalSequenceNumber++;
*[Guy]**This is a real concurrency killer, isn't AtomicLong a much better
solution?*
*2. LogRecord (line 149-154):*
Integer id = threadIds.get(); // This is a ThreadLocal…
*if* (id == *null*) {
id = *new* Integer(nextThreadId++);
threadIds.set(id);
}
threadID = id.intValue();
*[Guy] **Isn't Thread.currentThread().getId() a better solution?*
*3. LogRecord (line 143-144):*
// Make sure level isn't null, by calling random method.
level.getClass();
*[Guy] Is it really the best way to write a fast, readable and maintainable
code???*
Guy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20071223/5670be8f/attachment.html>
More information about the core-libs-dev
mailing list