[Geoserver-devel] GeoServer failing to swiftly dispose grid coverage readers on configuration reload

Hi,
looking into a testing annoyance today I realized that
GeoServer might be keeping grid coverage readers around for more
time that we'd like.

The class CoverageStoreInfo caches into a soft reference
the grid coverage readers it returns in order to avoid
recreating them. This is good performance wise, since some
readers (e.g. geotiff) have some relatively expensive
metadata parsing to do on first file access.

The trouble is, this way readers may go bye bye and never
get disposed of properly when:
* the soft reference expires
* the CoverageStoreInfo is thrown away in order to
   rebuild the geoserver configuration

The latter is something I can manage by adding a dispose method
to CoverageStoreInfo... not sure about the former thought.
I kind of rememeber there is something in the referencing
subsystem that allows to track soft references and do
some cleanup before they go out of business?
Martin, do you remember anything like that?

Cheers
Andrea