Hi Carlo, GREAT!! Your suggestion solves the use of GeoTIFFReader and releasing image file locks on finishing the use of a GridCoverage2D!
Please see same code structured also here: http://pastie.org/private/9jfbiymumcfnseleqlnqq GeoTiffReader reader = null; GridCoverage2D cov = null; try { File geotiff = ... //System.out.println("file found: " + geotiff.getAbsolutePath()); reader = new GeoTiffReader(geotiff); cov = reader.read(null); // doing something ... (like reading envelope etc.) } finally { if (cov != null) { try { // THIS IS ESSENTIAL FOR RELEASING LOCKS ON IMAGE FILES! PlanarImage planarImage = (PlanarImage) cov.getRenderedImage(); ImageUtilities.disposePlanarImageChain(planarImage); // TODO: necessary? //planarImage.dispose(); //planarImage.removeSinks(); cov.dispose(false); } catch (Throwable t) { // ignored } } if (reader != null) { try { reader.dispose(); } catch (Throwable t) { // ignored } } } I also looked into flushing JAI cache, however, it was not necessary anymore because your first suggestion was totally effective. Thanks a lot!! João -- View this message in context: http://osgeo-org.1560.n6.nabble.com/GeoTiffReader-unable-to-dispose-file-still-locked-tp5004582p5005503.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Got visibility? Most devs has no idea what their production app looks like. Find out how fast your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219671;13503038;y? http://info.appdynamics.com/FreeJavaPerformanceDownload.html _______________________________________________ GeoTools-GT2-Users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
