Andreas L Delmelle wrote:


On Nov 20, 2007, at 17:53, Chris Bowditch wrote:

Hi Chris


Hi Andreas,




Made yet another attempt to simplify/correct the design a bit (and hopefully fix the leak as well).

Thanks for taking the time to revisit this problem :)

Although I noticed that the diff appears to be against the previous revision of PropertyCache.java.


The implementation of the CacheEntry was not what it should have been...
By using a WeakReference as a member of the entry, it seems I was making things more difficult than they already are. The right way to go is to subclass WeakReference, and to perform cleanup via ReferenceQueues (as Jeremias suggested earlier). So, that's what happens now: each CacheSegment has its own queue of stale entries. Cleanup is now triggered unconditionally with each put(), and simply polls the reference queue. I removed the threading altogether. The cleanup/rehash is now always performed in the main thread.

Great. J2EE compliance restored :)



Let me know if it works on your end.

Bad news I'm afraid I didn't get very far at all with this change. It fails with NPE after about 8 documents!

java.lang.NullPointerException
at org.apache.fop.fo.properties.PropertyCache.cleanSegment(PropertyCache.java:112) at org.apache.fop.fo.properties.PropertyCache.put(PropertyCache.java:178) at org.apache.fop.fo.properties.PropertyCache.fetch(PropertyCache.java:289) at org.apache.fop.fo.properties.PropertyCache.fetch(PropertyCache.java:303) at org.apache.fop.fo.properties.ColorProperty.getInstance(ColorProperty.

Thanks,

Chris



Reply via email to