ASM #17215 - CAVE can lockup when volume browser is loaded but no element is selected

Change-Id: Ia672d2a4f5e38dcd3b1c43373993779557e86309

Former-commit-id: 97c938cb25 [formerly f8db9d993e [formerly 87ceca157b69dd6301f2ee0d6d9cee9aa7bb8bc8]]
Former-commit-id: f8db9d993e
Former-commit-id: f5db6cee9a
This commit is contained in:
David Friedman 2015-04-06 19:38:33 +00:00
parent 5e1c980eba
commit 587482c3aa
2 changed files with 76 additions and 4 deletions

View file

@ -28,6 +28,8 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.AbstractTimeMatcher;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.VizConstants;
import com.raytheon.uf.viz.core.drawables.AbstractDescriptor;
@ -39,10 +41,13 @@ import com.raytheon.uf.viz.core.globals.VizGlobalsManager;
import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.core.map.MapDescriptor;
import com.raytheon.uf.viz.core.maps.scales.MapScaleRenderableDisplay;
import com.raytheon.uf.viz.core.maps.scales.MapScalesManager;
import com.raytheon.uf.viz.core.maps.scales.MapScalesManager.ManagedMapScale;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.IResourceGroup;
import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.uf.viz.core.rsc.ResourceList.AddListener;
import com.raytheon.uf.viz.core.rsc.ResourceProperties;
import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
import com.raytheon.uf.viz.d2d.core.D2DProperties;
@ -61,6 +66,7 @@ import com.raytheon.viz.core.imagery.ImageCombiner;
* Feb 9, 2009 njensen Initial creation
* Mar 21, 2013 1638 mschenke Made map scales not tied to d2d
* Mar 22, 2013 1638 mschenke Moved map scale code to MapScaleRenderableDisplay
* Apr 06, 2015 ASM #17215 D. Friedman Implement clear to avoid removing time match basis
*
* </pre>
*
@ -321,4 +327,64 @@ public class D2DMapRenderableDisplay extends MapScaleRenderableDisplay
return combinerListener;
}
/** Like MapScaleRenderableDisplayer.clear, but avoids removing the time match
* basis until other resources are removed. This reduces time matching churn
* and reduces the chances of lockups.
* @see com.raytheon.uf.viz.core.maps.scales.MapScaleRenderableDisplay#clear()
*/
@Override
public void clear() {
AbstractVizResource<?, ?> timeMatchBasis = null;
AbstractTimeMatcher timeMatcher = descriptor.getTimeMatcher();
if (timeMatcher instanceof D2DTimeMatcher) {
timeMatchBasis = ((D2DTimeMatcher) timeMatcher).getTimeMatchBasis();
}
ManagedMapScale scale = MapScalesManager.getInstance().getScaleByName(
getScaleName());
if (scale != null) {
ResourceList list = descriptor.getResourceList();
for (ResourcePair rp : list) {
if (rp.getProperties().isSystemResource() == false) {
// Keep system resources
if (rp.getResource() != timeMatchBasis) {
list.remove(rp);
}
}
}
if (timeMatchBasis != null) {
list.removeRsc(timeMatchBasis);
}
loadScale(scale);
} else {
// Map scale could not be found, default to remove all
// non-map/system layers and reset display
ResourceList list = descriptor.getResourceList();
for (ResourcePair rp : list) {
ResourceProperties props = rp.getProperties();
if (props.isMapLayer() == false
&& props.isSystemResource() == false) {
if (rp.getResource() != timeMatchBasis) {
list.remove(rp);
}
} else {
try {
props.setVisible(true);
rp.getResource().recycle();
} catch (Throwable e) {
props.setVisible(false);
statusHandler.handle(Priority.PROBLEM, "Clear error: "
+ e.getMessage() + ":: The resource ["
+ rp.getResource().getSafeName()
+ "] has been disabled.", e);
}
}
}
if (timeMatchBasis != null) {
list.removeRsc(timeMatchBasis);
}
scaleToClientArea(getBounds());
}
}
}

View file

@ -69,6 +69,7 @@ import com.raytheon.viz.alerts.observers.ProductAlertObserver;
* Apr 09, 2014 2947 bsteffen Initial creation
* May 06, 2014 3117 bsteffen Update for new data.
* Sep 09, 2014 3356 njensen Remove CommunicationException
* Apr 06, 2014 #17215 D. Friedman Use ReentrantLock
*
* </pre>
*
@ -104,11 +105,16 @@ public class SatelliteInventory extends AbstractInventory implements
}
@Override
public synchronized void initTree(Map<String, DerivParamDesc> derParLibrary)
public void initTree(Map<String, DerivParamDesc> derParLibrary)
throws DataCubeException {
level = LevelFactory.getInstance().getLevel("EA", 0.0);
coverages = new SatelliteCoverageCache();
super.initTree(derParLibrary);
lock.lock();
try {
level = LevelFactory.getInstance().getLevel("EA", 0.0);
coverages = new SatelliteCoverageCache();
super.initTree(derParLibrary);
} finally {
lock.unlock();
}
}
@Override