[slf4j-user] Marker for object identification?

Ceki Gülcü listid at qos.ch
Thu Feb 8 22:47:08 CET 2007


Hi Boris,

At 10:32 PM 2/8/2007, Boris Unckel wrote:
>Hello Ceki,
>
>Ceki Gülcü wrote:
> > Markers can have children, so they are a bit more than plain old strings.
>Ah, thats the point.
>If you provide a delete(Marker markerToRemove) method, it will include
>all its children.

Good point but no. The children exist independently of the containing 
marker. So if you delete the containing marker, nothing happens to the 
children.

>Object xyz holds an reference to Marker("Boris")@1234 where 1234 is its
>Object.hashcode
>Object foo calls delete with an reference to Marker("Boris")@1234
>Object bar calls getMarker("Boris") and gets Marker("Boris")@6789
>
>xyz and bar have both an equal but not same marker...

That's a tough one. You could indeed create a marker with a given name, 
delete it, and then recreate it with the same name. There could be classes 
or objects referring to the old marker instance. They would be holding a 
"dangling" reference. The old and new markers would behave the same, and 
could be used interchangeably, as long as they contained the same children.

Anyway, since most markers don't have children, and since deleting a marker 
is only necessary when creating many markers dynamically, deletion should 
not cause problems, even if it could be problematic under different 
circumstances.

>So removing is not the best solution?

I don't know. Do you have anything better in mind? :-)

>Regards
>Boris

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch




More information about the slf4j-user mailing list