You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2005/07/15 03:32:13 UTC
DO NOT REPLY [Bug 35748] New: -
Use of read/write lock acquisition not necessarily safe in Category
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=35748>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=35748
Summary: Use of read/write lock acquisition not necessarily safe
in Category
Product: Log4j
Version: 1.3alpha
Platform: Other
OS/Version: other
Status: NEW
Severity: normal
Priority: P2
Component: Appender
AssignedTo: log4j-dev@logging.apache.org
ReportedBy: eross@m-qube.com
Refer to src/java/org/apache/log4j/Category.java :
try {
// Protect against simultaneous writes operations such as
// addAppender, removeAppender,...
c.lock.getReadLock();
...
} finally {
c.lock.releaseReadLock();
}
Although you're not using this class, this advice holds:
http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/locks/ReentrantLock.html
It is recommended practice to always immediately follow a call to lock with a
try block, most typically in a before/after construction such as:
class X {
private final ReentrantLock lock = new ReentrantLock();
// ...
public void m() {
lock.lock(); // block until condition holds
try {
// ... method body
} finally {
lock.unlock()
}
}
}
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org