On Mon, Aug 22, 2011 at 5:02 PM, Justin Deoliveira <[email protected]> wrote: > I think the patch sounds good, but I thought the issue with using a soft > reference based cache was that we could never be ensured that we got the > dispose method called. Or at least we could not be sure that he object was > still around. Scanned thought the machinery of soft hash map and still not > 100% sure.
The SoftHashMap has a "cleaner" that you can set to dispose of the referenced objects while the soft reference is getting phased out by the garbage collector. It is already in place but would not always work so I also made a couple of modifications in GeoTools to make it work always (they are in a correspondent geotools patch that I failed to publish). If you look at the patch the base class of all the resource caches implements a custom cleaner which then delegates to an abstract method that subclasses implement. The hard part is that testing for a soft reference to be removed is hard, the moment the reference becomes soft there is no way to tell how many times System.gc() needs to be called in order for that reference to actually be removed... Hmm... maybe I can use this and try to force (quickly) an OOM to prove soft reference disposal actually works: http://stackoverflow.com/questions/457229/how-to-cause-soft-references-to-be-cleared-in-java This is going to be nasty if we start using parallel builds, that OOM is going to create havoc in tests run in parallel... Cheers Andrea -- ------------------------------------------------------- Ing. Andrea Aime GeoSolutions S.A.S. Tech lead Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 962313 http://www.geo-solutions.it http://geo-solutions.blogspot.com/ http://www.youtube.com/user/GeoSolutionsIT http://www.linkedin.com/in/andreaaime http://twitter.com/geowolf ------------------------------------------------------- ------------------------------------------------------------------------------ uberSVN's rich system and user administration capabilities and model configuration take the hassle out of deploying and managing Subversion and the tools developers use with it. Learn more about uberSVN and get a free download at: http://p.sf.net/sfu/wandisco-dev2dev _______________________________________________ Geoserver-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geoserver-devel
