svn - r34335 - trunk/modules/plugin/arcsde/datastore/src/main/java/org/geotools/arcsde/raster/io

1 message Options
Embed this post
Permalink
svn_geotools

svn - r34335 - trunk/modules/plugin/arcsde/datastore/src/main/java/org/geotools/arcsde/raster/io

Reply Threaded More More options
Print post
Permalink
Author: groldan
Date: 2009-11-05 12:33:34 -0500 (Thu, 05 Nov 2009)
New Revision: 34335

Modified:
   trunk/modules/plugin/arcsde/datastore/src/main/java/org/geotools/arcsde/raster/io/NativeTileReader.java
Log:
GEOT-2616, make sure NativeTileReader can be reused (as in the image using it being used more than once)

Modified: trunk/modules/plugin/arcsde/datastore/src/main/java/org/geotools/arcsde/raster/io/NativeTileReader.java
===================================================================
--- trunk/modules/plugin/arcsde/datastore/src/main/java/org/geotools/arcsde/raster/io/NativeTileReader.java 2009-11-05 16:41:18 UTC (rev 34334)
+++ trunk/modules/plugin/arcsde/datastore/src/main/java/org/geotools/arcsde/raster/io/NativeTileReader.java 2009-11-05 17:33:34 UTC (rev 34335)
@@ -262,6 +262,8 @@
     private void execute() throws IOException {
         final Rectangle requestedTiles = this.requestedTiles;
         this.tileFetchCommand = execute(requestedTiles);
+        this.started = true;
+        this.lastTileX = this.lastTileY = -1;
     }
 
     private TileFetchCommand execute(final Rectangle rasterTiles) throws IOException {
@@ -376,7 +378,9 @@
     private int lastTileY = -1;
 
     private TileInfo[] fetchTile(final int tileX, final int tileY) throws IOException {
-
+        if(!started){
+            execute();
+        }
         TileInfo[] tileInfo = null;
 
         if (isConsecutive(tileX, tileY)) {
@@ -438,11 +442,6 @@
     }
 
     private TileInfo[] nextTile() throws IOException {
-        if (!started) {
-            execute();
-            started = true;
-        }
-
         TileInfo[] nextTile;
         try {
             nextTile = session.issue(tileFetchCommand);
@@ -492,13 +491,15 @@
                     LOGGER.log(Level.WARNING, "Closing tile reader's prepared Query", e);
                 }
             }
-            tileFetchCommand = null;
             if (LOGGER.isLoggable(Level.FINER)) {
                 LOGGER.finer("Disposing " + session + " on thread "
                         + Thread.currentThread().getName());
             }
             session.dispose();
             session = null;
+
+            // get ready for more invocations
+            tileFetchCommand = null;
             started = false;
         }
     }


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
GeoTools-commits mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-commits