[slf4j-dev] svn commit: r786 - in slf4j/trunk/slf4j-api/src/main/java/org/slf4j: . helpers

ceki at slf4j.org ceki at slf4j.org
Sun Apr 15 21:47:56 CEST 2007


Author: ceki
Date: Sun Apr 15 21:47:56 2007
New Revision: 786

Modified:
   slf4j/trunk/slf4j-api/src/main/java/org/slf4j/IMarkerFactory.java
   slf4j/trunk/slf4j-api/src/main/java/org/slf4j/helpers/BasicMarkerFactory.java

Log:
Added a mechanism to detach markers. See also http://bugzilla.slf4j.org/show_bug.cgi?id=39

Modified: slf4j/trunk/slf4j-api/src/main/java/org/slf4j/IMarkerFactory.java
==============================================================================
--- slf4j/trunk/slf4j-api/src/main/java/org/slf4j/IMarkerFactory.java	(original)
+++ slf4j/trunk/slf4j-api/src/main/java/org/slf4j/IMarkerFactory.java	Sun Apr 15 21:47:56 2007
@@ -57,4 +57,16 @@
    * @return true id the marker exists, false otherwise. 
    */
   boolean exists(String name);
+  
+  /**
+   * Detach an existing marker.
+   * <p>
+   * Note that after a marker is detached, there might still be "dangling" references
+   * to the detached marker.
+   * 
+   * 
+   * @param name The name of the marker to detach
+   * @return whether the marker  could be detached or not
+   */
+  boolean detachMarker(String name);
 }

Modified: slf4j/trunk/slf4j-api/src/main/java/org/slf4j/helpers/BasicMarkerFactory.java
==============================================================================
--- slf4j/trunk/slf4j-api/src/main/java/org/slf4j/helpers/BasicMarkerFactory.java	(original)
+++ slf4j/trunk/slf4j-api/src/main/java/org/slf4j/helpers/BasicMarkerFactory.java	Sun Apr 15 21:47:56 2007
@@ -81,5 +81,12 @@
     }
     return markerMap.containsKey(name);
   }
+
+  public boolean detachMarker(String name) {
+    if(name == null) {
+      return false;
+    }
+    return (markerMap.remove(name) != null);
+  }
   
 }



More information about the slf4j-dev mailing list