"Jakarta Commons Developers List" <[email protected]> schrieb am 
24.12.04 11:09:48:

> Well, here's an example, of the top of my head. A weakly referencing 
> list could be useful for implementing the observer pattern in a 
> situation where you don't want the listeners to be strongly referenced 
> by the event source. If the event source uses such a list to hold its 
> listeners, then as long as the listeners remain strongly referenced, 
> they will continue to receive events from the source. There will be no 
> need to explicitly unregister the listeners, as once they become weakly 
> referenced, then they will effectively be removed from the event 
> listener list automatically.
> 
> Chris

Thank you Chris, this is exactly what I was thinking of :). With such a List, 
it is possible to protect developers against creating memory leaks 
unintentionally, when they forget to invoke the accordant removeListener(...) 
method (assuming the list is strongly referenced by a long-living object). I 
think there is an Antipattern called "Lapsed Listeners Leak" that describes 
this problem.
________________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt neu bei WEB.DE FreeMail: http://freemail.web.de/?mc=021193


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to