continued threading issues

I am using visad in an offscreen mode, inside a web application environment (Tomcat 5.5 is container). Yet again I am having threading issues in that sometimes visad appears to lock up.

I create a DisplayImplJ2D, add scalar maps, then add some data. I then always call

BufferedImage bi = displayImplJ2D.getImage( true );

I note that in certain situations this call hangs.

I note that the 'true' parameter forces a retransformation and redraw of the 'scene'. If I experiment with a false value, it can lead incomplete graphics, ie Data objects not yet drawn.

This lack of understanding of the thread model has been my most frustrating bugbear using Visad. As I see it, I will have one thread per DisplayImpl (since the VisADCanvasJ2D created for each display starts its own thread), plus 5 threads in the ThreadPool. Are there any others ? Should I be using more calls to disableAction/enableAction and trying to coordinate a 'finished image' by listening for DisplayEvents of type FRAME_DONE?

On a somewhat related note, I am better off using one DisplayImpl object, at least one per 'user' (== user agent) and then toggling 'layers' of data on and off using DataRenderers so that I get an image containing just one Data object drawn, or should I use a separate DisplayImp object for each Data object (examples of Data for my app are coastline, bathymetry contours, model grid contours, etc)

I am trying to build a browser based UI system with visad producing BufferedImages on the server which I then convert to gif/png for browser consumption. If I can only track down/understand the fail-safe method for producing the BufferedImage objects.

I am tempted to hack the ThreadPool to create just one thread and see how that goes.


Any help very gratefully appreciated.

Stuart

==============================================================================
To unsubscribe visad, visit:
http://www.unidata.ucar.edu/mailing-list-delete-form.html
==============================================================================