Deadlock in DisplayImpl or ScalarMap?


I am having trouble with (I think) a deadlock in DisplayImpl or
ScalarMap.  Details:

There is code in my app that adds a DataReference to a DisplayImplJ3D.
The code does this inside SwingUtilities.invokeLater() in a SwingWorker

  for ... {
    display.addReferences(renderer, dataRef, constantMaps, constantMaps.length);

The SwingWorker thread takes care of loading the data via ADDE before
adding data to the display, so it happens in the background.

When the display already has a number of DataReferences (about 8), I get
the app to add one more.  At that point everything hangs, ie the display
stops updating (all swing components and the visad component) with no
cpu usage.

By tracing with the universal debugging tool (System.out.println()) I
can see that one VisAD thread is in, synchronized on
lockEnabled, and an AWT thread (presumably from
SwingUtilities.invokeLater()) is waiting to synchronize in the same
place.  The VisAD thread does not leave the synchronized block, it gets
to DisplayRenderer.prepareAction(), calls map.setRange(shadow) where map
is a ScalarMap (Time->DisplayAnimation) and hangs there.

Now, I can keep tracing to find out what is happening in the ScalarMap,
but I thought I'd ask here to see if anyone might be able to recognise
this.  Anyone?  Bill?  :)


Russell Steicke

-- Fortune says:
Can anyone remember when the times were not hard, and money not scarce?