public void dispose(){
  setLayerRemovalDelayed(false);
  if (projectionSupport != null) {
    projectionSupport.dispose();
    projectionSupport=null;
  }
  if (painters != null) {
    painters.clear();
    painters=null;
  }
  if (addedLayers != null) {
    addedLayers.removeAllElements();
    addedLayers=null;
  }
  currentLayers=null;
  projectionFactory=null;
  removeComponentListener(this);
  removeContainerListener(this);
  removeAll();
  purgeAndNotifyRemovedLayers();
}

public void dispose ( ) { setLayerRemovalDelayed ( false ) ; if ( projectionSupport != null ) { projectionSupport . dispose ( ) ; projectionSupport = null ; } if ( painters != null ) { painters . clear ( ) ; painters = null ; } if ( addedLayers != null ) { addedLayers . removeAllElements ( ) ; addedLayers = null ; } currentLayers = null ; projectionFactory = null ; removeComponentListener ( this ) ; removeContainerListener ( this ) ; removeAll ( ) ; purgeAndNotifyRemovedLayers ( ) ; }
call when getting rid of the mapbean , it releases pointers to all listeners and kills the projectionsupport thread .
