Hi GT-developers,

the last testcase is updated herewith to dispose the coverage and
GeoTIFFReader and finishes just in case the lock on the GeoTIFF file is
released (which in my case under Windows never happens).
I used the Windows tool "Unlocker" to keep track on locking. (I realized in
the last testcase (loop over a reader) that GC shrinks the amount of locks
after a long while, but not all locks.)


Updated Java code, which just once uses GeoTIFFReader to read a
GridCoverage2D from a GeoTIFF file and keeps trying to delete the GeoTIFF
file (in an infitie lopp), also tried to dispose coverage and reader:
http://pastie.org/private/b54dldzjun340qjgmffbig

PLEASE SAVE THE PIECE OF CODE UNDER THE NAME: GeoTIFFReaderTest3.java

You will additionally need the commons-lang library for the StopWatch:
commons-lang-2.4.jar


compile with:
javac -cp
".;commons-lang-2.4.jar;gt-api-2.7.5.jar;gt-coverage-2.7.5.jar;gt-epsg-wkt-2.7.5.jar;gt-geotiff-2.7.5.jar;gt-metadata-2.7.5.jar;gt-opengis-2.7.5.jar;gt-referencing-2.7.5.jar;imageio-ext-tiff-1.1.3.jar;imageio-ext-utilities-1.1.3.jar;jai_codec-1.1.3.jar;jai_core-1.1.3.jar;jai_imageio-1.1.jar;jsr-275-1.0-beta-2.jar;vecmath-1.3.2.jar"
GeoTIFFReaderTest3.java

start with:
java -cp
".;commons-lang-2.4.jar;gt-api-2.7.5.jar;gt-coverage-2.7.5.jar;gt-epsg-wkt-2.7.5.jar;gt-geotiff-2.7.5.jar;gt-metadata-2.7.5.jar;gt-opengis-2.7.5.jar;gt-referencing-2.7.5.jar;imageio-ext-tiff-1.1.3.jar;imageio-ext-utilities-1.1.3.jar;jai_codec-1.1.3.jar;jai_core-1.1.3.jar;jai_imageio-1.1.jar;jsr-275-1.0-beta-2.jar;vecmath-1.3.2.jar"
GeoTIFFReaderTest3


I don't get how to successfully dispose the coverage and reader so that the
lock on the GeoTIFF file will be released.
It's important for me to be able to delete, move or rename the file.
Alternatively copying such giant GeoTIFF files in size just for reading the
Envelope would be a solution, but totally inefficient.
Could someone please tell me how to successfully dispose?

João



--
View this message in context: 
http://osgeo-org.1560.n6.nabble.com/GeoTiffReader-unable-to-dispose-file-still-locked-tp5004582p5004717.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
How fast is your code?
3 out of 4 devs don\\\'t know how their code performs in production.
Find out how slow your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219672;13503038;z?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to