ImageWorker should provide a dispose method -------------------------------------------
Key: GEOT-3907 URL: https://jira.codehaus.org/browse/GEOT-3907 Project: GeoTools Issue Type: Improvement Components: coverage Affects Versions: 8.0-M2, 2.7.3, 2.7.4, 8.0-M3 Reporter: Simone Giannecchini Assignee: Simone Giannecchini Priority: Minor ImageWorker does not provide a method to dispose it. Although we can do this externally and although this is done most part of the time since the image it contains are reused externally, it would be great to have such a method at hand to not having to do it manually all the time. Notice that I would refrain from putting also a finalize method where we discards soruces recrusively since we might be using the internal image somewhere else externally. Here some sample code to use: /** * Provides a hint that this {@link ImageWorker} will no longer be accessed from a reference in user space. The * results are equivalent to those that occur when the program loses its last reference to this * image, the garbage collector discovers this, and finalize is called. This can be used as a * hint in situations where waiting for garbage collection would be overly conservative. * * {@link ImageWorker} defines this method to remove the image being disposed from the list of sinks in * all of its source images. * * The results of referencing an {@link ImageWorker} after a call to dispose() are undefined. */ public final void dispose(){ this.commonHints.clear(); this.commonHints=null; this.roi=null; if(this.image instanceof PlanarImage) ImageUtilities.disposePlanarImageChain(PlanarImage.wrapRenderedImage(image)); else if(this.image instanceof BufferedImage){ ((BufferedImage)this.image).flush(); this.image=null; } } -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct _______________________________________________ Geotools-devel mailing list Geotools-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel