https://issues.apache.org/bugzilla/show_bug.cgi?id=51047

           Summary: Move org.apache.log4j.Category to reentrant read/write
                    locks
           Product: Log4j
           Version: 1.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: major
          Priority: P2
         Component: Other
        AssignedTo: [email protected]
        ReportedBy: [email protected]


As mentioned in https://issues.apache.org/bugzilla/show_bug.cgi?id=41214#c36
and 
https://issues.apache.org/bugzilla/show_bug.cgi?id=50213#c6, 
org.apache.log4j.Category uses a suboptimal synchronization mechanism. All
methods are synchronized and treated the same way no matter if they modify the
list of appenders or not.

This might cause performance degradation in a really multithreaded env.

It should not be hard to improve this synchronization mechanism without the
need to change API. Introduce a read-write lock to be used on all _non-static_
methods - instead of the synchronized keyword? 

Log4j 1.2.x is compliant with JDK 1.2, right? If so, using
java.util.concurrent.locks classes is not an option. Maybe a simple custom impl
of read-write lock would be enough? It might not be optimal to use a custom
class. Maybe backport util concurrent? If adding external dependencies to the
1.2 branch of log4j is not an option, maybe we could inline the the reentrant
read-write lock class into log4j?

WDYT?

I could create a patch once you decide which option is the best one.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to