ImageLoader overhaul needed
---------------------------

                 Key: GEOT-1536
                 URL: http://jira.codehaus.org/browse/GEOT-1536
             Project: GeoTools
          Issue Type: Bug
          Components: core render
    Affects Versions: 2.5-M0, 2.4-RC0
            Reporter: Andrea Aime
            Assignee: Jesse Eichar
             Fix For: 2.4-RC1, 2.5-M1


ImageLoader has a couple of issues I'm going to discuss now.
First of all, let's consider that the only code that still uses ImageLoader is 
the SLDStyleFactory, which uses it to load external graphics in non interactive 
mode. At the current state, there is no code trying to use that class in 
interactive mode.

The responsibilities for ImageLoader are:
* load external images, eventually returning null immediatly but keep on 
loading the file in the background (interactive mode)
* load external images blocking the caller (non interactive mode)
* cache the results so that the image loading does not occurr over and over 
again

Image loading is done using MediaTracker, a bunch of sleep(xxx) and a 10 
seconds timeout which is probably the cause
of the issues we're seeing in GeoServer (see linked issue).
If we give up interactive loading (which is not used), we could load an image 
by simply using ImageIO.read(url), that would
be simpler and possibly more reliable.

Image caching is to be kept, but current code has two limitations:
* image cache is static and unbounded, meaning that once an image is loaded, 
it'll stay there as long as the application lives. This may be troublesome, 
especially if someone loads by mistake a big image instead of small icons. 
Using a SoftValueHashMap should address this problem.
* the cache is keyed by url, no attempt is made to see if the file system or 
the external server has a fresher copy of the data (maybe the content has been 
replaced). We should avoid that and make sure the url does point to the same 
data (e.g., if it's a file use latest modification date, if it's a http 
connection consider caching limits or do a conditional get retrieving data only 
if it has been modified after a certain date... 
not sure there is any general way to do so, for http see 
http://www.oreillynet.com/onjava/blog/2004/07/optimizing_http_downloads_in_j.html)

I would like your opinions on this one. Am I missing something? Any suggestions 
on how to proceed?


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to