[logback-dev] svn commit: r1733 - in logback/trunk: logback-classic/src/main/java/ch/qos/logback/classic/jmx logback-core/src/main/java/ch/qos/logback/core logback-core/src/main/java/ch/qos/logback/core/status logback-core/src/main/java/ch/qos/lo

Ceki Gulcu listid at qos.ch
Thu Aug 7 10:16:17 CEST 2008

Jörn Huxhorn wrote:

> Yes, definitely @ synchronized(statusList).
> I just think that
> public synchronized List<Status> getCopyOfStatusList()
> should be
> public List<Status> getCopyOfStatusList()
> so there is no risk of deadlock.

Oh yes, I was just not seeing the "synchronized" keyword on the method 
signature. It should not be there.

> I haven't checked if there *is* a risk of deadlock but there *could* be
> under certain circumstances, i.e. if there would be another place that
> synchronizes on statusList first and on Object later. I don't think there is
> such a piece of code but it's generally a good idea to not
> synchronize/holding two locks if not absolutely necessary. It's also a bit
> faster.

Thank you for taking the time to go over this so cool-headedly. I really 
appreciate it.

> Joern.

Ceki Gülcü

More information about the logback-dev mailing list