Details
Description
FeatureListenerManager uses a standard hashmap to hold the list of event listener lists keyed by FeatureSource.
If the user is making map context, the list will be populated by DefaultMapLayer source listeners, with the default map layer pointing at the feature source as well. This means that if the map context does not get cleared by the application after usage, we have a memory leak around (both the map context and the feature source end up being held by the feature listener manager).
Turning the hashmap into a weak hash map does not help, since the EventListenerLists are still kept by strong references (weak hash map has weak references only on keys).
We need that, and a listener list that referes to the listeners thru weak references.
This is possible, but unfortunately, for some strange reason, the FeatureListenerManager.eventListenerList is public, making it harder to change the class to use a flat arraylist of WeakReference<FeatureListener>.
What shall we do? Deprecate the method, replace it with an internal one playing with List<WeakReference<FeatureListener>>, and build an EventListernList on the fly is someone is still calling
the old public one?