Omaha #3353 Fix deadlock that freezes cave.
Change-Id: I4afa5c505178f30ada5dd58612b0703ab9529e6b Former-commit-id:334b156d2e
[formerly398a8d6043
] [formerlyacbde703a2
[formerly 871fa68ddf242f1e63286939b1324fc3197c7336]] Former-commit-id:acbde703a2
Former-commit-id:f27f2c456a
This commit is contained in:
parent
e42a5d296f
commit
304a337a0f
3 changed files with 139 additions and 19 deletions
|
@ -67,6 +67,7 @@ import com.raytheon.uf.common.dataplugin.warning.config.BulletActionGroup;
|
|||
import com.raytheon.uf.common.dataplugin.warning.config.DialogConfiguration;
|
||||
import com.raytheon.uf.common.dataplugin.warning.config.GridSpacing;
|
||||
import com.raytheon.uf.common.dataplugin.warning.config.WarngenConfiguration;
|
||||
import com.raytheon.uf.common.dataplugin.warning.gis.GenerateGeospatialDataResult;
|
||||
import com.raytheon.uf.common.dataplugin.warning.gis.GeospatialData;
|
||||
import com.raytheon.uf.common.dataplugin.warning.gis.GeospatialDataSet;
|
||||
import com.raytheon.uf.common.dataplugin.warning.gis.GeospatialFactory;
|
||||
|
@ -231,6 +232,7 @@ import com.vividsolutions.jts.io.WKTReader;
|
|||
* 09/15/2014 3353 rferrel No longer have null parent shell for the GenerateGeoDataSetDialog.
|
||||
* 09/17/2014 ASM #15465 Qinglu Lin get backupOfficeShort and backupOfficeLoc from backup WFO config.xml, and pop up AlertViz if
|
||||
* any of them is missing.
|
||||
* 11/03/2014 3353 rferrel Ignore GeoSpatialData notification when this is the instance layer will do an update.
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
|
@ -242,13 +244,21 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
|||
.getHandler(WarngenLayer.class);
|
||||
|
||||
String uniqueFip = null;
|
||||
|
||||
String backupOfficeShort = null;
|
||||
|
||||
String backupOfficeLoc = null;
|
||||
|
||||
Map<String, Double> geomArea = new HashMap<String, Double>();
|
||||
|
||||
Map<String, Point> geomCentroid = new HashMap<String, Point>();
|
||||
|
||||
/**
|
||||
* Geospatial data generator notifications caused by instance's actions.
|
||||
* When notification arrives no futher work needs to be done.
|
||||
*/
|
||||
private final Set<String> ignoreNotifications = new HashSet<String>();
|
||||
|
||||
private static class GeospatialDataList {
|
||||
|
||||
private static final String LOCAL_GEOM = "localGeometry";
|
||||
|
@ -654,21 +664,33 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
|||
|
||||
@Override
|
||||
public void notificationArrived(NotificationMessage[] messages) {
|
||||
boolean initWarngen = false;
|
||||
for (NotificationMessage message : messages) {
|
||||
try {
|
||||
Object payload = message.getMessagePayload();
|
||||
if (payload instanceof String) {
|
||||
System.out
|
||||
.println("Geometry Metadata has been updated based on "
|
||||
+ payload + " shapefile data");
|
||||
warngenLayer.siteMap.clear();
|
||||
warngenLayer.init(warngenLayer.configuration);
|
||||
if (payload instanceof GenerateGeospatialDataResult) {
|
||||
GenerateGeospatialDataResult result = (GenerateGeospatialDataResult) payload;
|
||||
synchronized (warngenLayer.ignoreNotifications) {
|
||||
String curKey = result.getArea() + "."
|
||||
+ result.getSite();
|
||||
|
||||
if (warngenLayer.ignoreNotifications
|
||||
.contains(curKey)) {
|
||||
warngenLayer.ignoreNotifications.remove(curKey);
|
||||
} else {
|
||||
siteMap.remove(curKey);
|
||||
initWarngen = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NotificationException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Getting notification message's payload", e);
|
||||
}
|
||||
}
|
||||
if (initWarngen) {
|
||||
warngenLayer.init(warngenLayer.configuration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1220,12 +1242,13 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
|||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
}
|
||||
customMaps.loadCustomMaps(Arrays.asList(config.getMaps()));
|
||||
|
||||
createAreaAndCentroidMaps();
|
||||
|
||||
this.configuration = config;
|
||||
}// end synchronize
|
||||
customMaps.loadCustomMaps(Arrays.asList(config.getMaps()));
|
||||
|
||||
createAreaAndCentroidMaps();
|
||||
|
||||
this.configuration = config;
|
||||
System.out.println("Total time to init warngen config = "
|
||||
+ (System.currentTimeMillis() - t0) + "ms");
|
||||
}
|
||||
|
@ -1267,6 +1290,16 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
|||
} else {
|
||||
// This makes sure dialog exists and is open
|
||||
createDialog();
|
||||
|
||||
/*
|
||||
* Add to list prior to opening the genDialog. That
|
||||
* way if the notfication arrives prior to or after
|
||||
* closing the genDialog the notfication will be
|
||||
* ignored.
|
||||
*/
|
||||
synchronized (ignoreNotifications) {
|
||||
ignoreNotifications.add(currKey);
|
||||
}
|
||||
GenerateGeoDataSetDialog genDialog = new GenerateGeoDataSetDialog(
|
||||
dialog.getShell(), site, gmd);
|
||||
|
||||
|
@ -1490,10 +1523,12 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
|||
boolean shortTag = false;
|
||||
boolean locTag = false;
|
||||
String infoType = null;
|
||||
if (backupOfficeShort == null || backupOfficeShort.trim().length() == 0) {
|
||||
if (backupOfficeShort == null
|
||||
|| backupOfficeShort.trim().length() == 0) {
|
||||
shortTag = true;
|
||||
}
|
||||
if (backupOfficeLoc == null || backupOfficeLoc.trim().length() == 0) {
|
||||
if (backupOfficeLoc == null
|
||||
|| backupOfficeLoc.trim().length() == 0) {
|
||||
locTag = true;
|
||||
}
|
||||
if (shortTag && locTag) {
|
||||
|
@ -1506,8 +1541,9 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
|||
}
|
||||
}
|
||||
if (infoType != null) {
|
||||
statusHandler.handle(Priority.CRITICAL, "Info for " + infoType + " in " + backupSite +
|
||||
"'s config.xml is missing.");
|
||||
statusHandler.handle(Priority.CRITICAL, "Info for "
|
||||
+ infoType + " in " + backupSite
|
||||
+ "'s config.xml is missing.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1601,7 +1637,9 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
|||
public enum GeoFeatureType {
|
||||
COUNTY("county", "FIPS"), MARINE("marinezones", "ID");
|
||||
final private String tableName;
|
||||
|
||||
final private String fipsField;
|
||||
|
||||
private GeoFeatureType(String tableName, String fipsField) {
|
||||
this.tableName = tableName;
|
||||
this.fipsField = fipsField;
|
||||
|
@ -1649,7 +1687,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
|||
else if (type == GeoFeatureType.MARINE)
|
||||
templateName = "specialMarineWarning";
|
||||
else
|
||||
throw new IllegalArgumentException("Unsupported geo feature type " + type);
|
||||
throw new IllegalArgumentException(
|
||||
"Unsupported geo feature type " + type);
|
||||
WarngenConfiguration config = WarngenConfiguration.loadConfig(
|
||||
templateName, getLocalizedSite(), null);
|
||||
loadGeodataForConfiguration(config);
|
||||
|
|
|
@ -47,6 +47,7 @@ import com.raytheon.uf.common.dataplugin.warning.config.AreaSourceConfiguration;
|
|||
import com.raytheon.uf.common.dataplugin.warning.config.DialogConfiguration;
|
||||
import com.raytheon.uf.common.dataplugin.warning.config.GeospatialConfiguration;
|
||||
import com.raytheon.uf.common.dataplugin.warning.config.WarngenConfiguration;
|
||||
import com.raytheon.uf.common.dataplugin.warning.gis.GenerateGeospatialDataResult;
|
||||
import com.raytheon.uf.common.dataplugin.warning.gis.GeospatialData;
|
||||
import com.raytheon.uf.common.dataplugin.warning.gis.GeospatialDataSet;
|
||||
import com.raytheon.uf.common.dataplugin.warning.gis.GeospatialFactory;
|
||||
|
@ -109,6 +110,7 @@ import com.vividsolutions.jts.simplify.TopologyPreservingSimplifier;
|
|||
* Apr 29, 2014 3033 jsanchez Properly handled site and back up site files.
|
||||
* Jul 15, 2014 3352 rferrel Better logging and threading added.
|
||||
* Aug 21, 2014 3353 rferrel Added getGeospatialTimeset and cluster locking of METADATA_FILE.
|
||||
* generateGeoSpatialList now sends GenerateGeospatialDataResult.
|
||||
* </pre>
|
||||
*
|
||||
* @author rjpeter
|
||||
|
@ -457,12 +459,15 @@ public class GeospatialDataGenerator {
|
|||
persistGeoData(site, lastRunTimeMap, curTime, dataSet);
|
||||
|
||||
if (updaterEndpoint != null) {
|
||||
GenerateGeospatialDataResult result = new GenerateGeospatialDataResult();
|
||||
String updatedTimeStamp = getTimeStamp(curTime,
|
||||
lastRunTime);
|
||||
|
||||
result.setTimestamp(updatedTimeStamp);
|
||||
result.setSite(site);
|
||||
result.setArea(metaData.getAreaSource());
|
||||
try {
|
||||
EDEXUtil.getMessageProducer().sendAsync(
|
||||
updaterEndpoint, updatedTimeStamp);
|
||||
updaterEndpoint, result);
|
||||
} catch (EdexException e) {
|
||||
statusHandler.error("Could not send message to "
|
||||
+ updaterEndpoint, e);
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.dataplugin.warning.gis;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
||||
/**
|
||||
* The results from a GenerateGeospatialDataRequest.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 3, 2014 3353 rferrel Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
@DynamicSerialize
|
||||
public class GenerateGeospatialDataResult {
|
||||
@DynamicSerializeElement
|
||||
private String timestamp;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String site;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String area;
|
||||
|
||||
public String getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public void setTimestamp(String timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public String getSite() {
|
||||
return site;
|
||||
}
|
||||
|
||||
public void setSite(String site) {
|
||||
this.site = site;
|
||||
}
|
||||
|
||||
public String getArea() {
|
||||
return area;
|
||||
}
|
||||
|
||||
public void setArea(String area) {
|
||||
this.area = area;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue