On Fri, 2004-09-17 at 11:51, Ceki GÃlcà wrote: > Do you realize that the main reason for synchronization in doAppend method > is avoiding simultaneous writes to the same output device? Any write > operation which is not synchronized (or otherwise protected against > simultaneous access) is a big no no... >
The java.io.Writer classes are synchronized internally. There is a lock internally, so the only reason to lock externally is to synchronize state on another operation. Say, if you do w.write(X); w.write(Y); If you want to write multiple times safely, you can lock the object directly. Holding a lock on the appender while doing all writes is a little heavy-handed. Yoav Shapira wrote: > Hi, > We also want to be careful not to change this central piece of code > unless absolutely needed, i.e. if people start reporting bugs in this > area. Log4j is in heavy use and this code has not significantly > changed in years, so I'm inclined to think it's fairly solid ;) I'm thinking log4j should keep what it has. I am just suggesting it might be worthwhile having an implementation (or relative object tree) of AppenderSkeleton which use, say read-write locks, that avoids this problem. I'd be happy to contribute this, so it'd be no work for the rest of you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
