[OpenMap Users] deadlock in LayerHandler when calling moveLayer from listener.setLayers()

From: William Barber <wbarber_at_lanl.gov>
Date: Mon, 21 Aug 2006 16:01:56 -0600 (MDT)

Hi folks,

our application contains several layers that we expose in the LayersPanel, which
the user is allowed to rearrange at will. It also contains 3 "invisible" layers,
which must sit on top of the exposed layers in the layer stack. We start by
adding these 3 layers on top, which is fine. But, in the setLayers() method in
our class that implements LayerListener, I have 3 moveLayer() calls to ensure
that, if someone moves an exposed layer to the top, the 3 invisible layers get
moved back on top of all the layers. eg.:

public void setLayers(LayerEvent e) {
   switch(type) {
     case LayerEvent.ALL:
       layerHandler.moveLayer(flashLayer, 0);
       layerHandler.moveLayer(highlightLayer, 1);
       layerHandler.moveLayer(virtualLayer, 2);

These moveLayers() calls seem to be causing
a deadlock in the LayerHandler setLayers() method (see thread dump below).
The deadlock occurs in the first line of LayerHandler.setLayers() (line 488):

    allLayers = layers;

Is there an accepted way to safely rearrange layers from within on the app's
setLayers() method?

Many thanks for any help, Bill Barber
OpenMap(tm) Version 4.6.3
   Copyright (C) BBNT Solutions LLC. All rights reserved.
   See http://openmap.bbn.com/ for details.

Full thread dump Java HotSpot(TM) Client VM (1.5.0_06-b05 mixed mode, sharing):

"Thread-11" prio=1 tid=0x0861c358 nid=0x16f4 waiting for monitor entry
         at com.bbn.openmap.LayerHandler.setLayers(LayerHandler.java:488)
         - waiting to lock <0x5cc8c1c0> (a com.bbn.openmap.LayerHandler)
         at com.bbn.openmap.LayerHandler.moveLayer(LayerHandler.java:645)
         at userinterface.vis2d.Map.setLayers(Map.java:495)
         at com.bbn.openmap.event.LayerSupport.fireLayer(LayerSupport.java:91)
         - locked <0x5cc8c230> (a com.bbn.openmap.event.LayerSupport)
         at java.lang.Thread.run(Thread.java:595)

"TimerQueue" daemon prio=1 tid=0x085dcad0 nid=0x16ef in Object.wait()
         at java.lang.Object.wait(Native Method)
         - waiting on <0x5d046e20> (a javax.swing.TimerQueue)
         at javax.swing.TimerQueue.run(TimerQueue.java:233)
         - locked <0x5d046e20> (a javax.swing.TimerQueue)
         at java.lang.Thread.run(Thread.java:595)

[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Mon Aug 21 2006 - 18:33:50 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:07 EDT