[logback-dev] svn commit: r2072 - logback/trunk/logback-core/src/main/java/ch/qos/logback/core/status

noreply.ceki at qos.ch noreply.ceki at qos.ch
Fri Dec 5 18:13:07 CET 2008


Author: ceki
Date: Fri Dec  5 18:13:07 2008
New Revision: 2072

Modified:
   logback/trunk/logback-core/src/main/java/ch/qos/logback/core/status/StatusBase.java

Log:

The getEffectiveLevel() method needs to be synchronized to protect
against concurrent modification when iterating over
childrenList.iterator().


Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/status/StatusBase.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/status/StatusBase.java	(original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/status/StatusBase.java	Fri Dec  5 18:13:07 2008
@@ -62,17 +62,19 @@
     if (childrenList == null) {
       return false;
     }
-
-    // TODO also search in childrens' childrens
+    // TODO also search in childrens' children
     return childrenList.remove(statusToRemove);
-
   }
 
   public int getLevel() {
     return level;
   }
 
-  public int getEffectiveLevel() {
+  // status messages are not supposed to contains cycles.
+  // cyclic status arrangements are like to cause deadlocks
+  // when this method is called from different thread on
+  // different status objects lying on the same cycle
+  public synchronized int getEffectiveLevel() {
     int result = level;
     int effLevel;
 
@@ -85,7 +87,6 @@
         result = effLevel;
       }
     }
-
     return result;
   }
 


More information about the logback-dev mailing list