Merge branch 'master_14.2.3' into master_14.2.4

Former-commit-id: 876c6fc4db3901fdcd8dd9a6fb343d2f65254569
This commit is contained in:
Brian.Dyke 2014-09-05 11:13:12 -04:00
commit 9e1ee22146
5 changed files with 123 additions and 116 deletions

View file

@ -37,7 +37,6 @@ import org.opengis.referencing.crs.ProjectedCRS;
import com.raytheon.uf.common.dataplugin.radar.RadarDataKey;
import com.raytheon.uf.common.dataplugin.radar.RadarDataPoint;
import com.raytheon.uf.common.dataplugin.radar.RadarDataPoint.RadarProductType;
import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
import com.raytheon.uf.common.dataplugin.radar.level3.GraphicBlock;
import com.raytheon.uf.common.dataplugin.radar.level3.Layer;
@ -70,6 +69,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* ------------ ---------- ----------- --------------------------
* Jan 13, 2009 chammack Initial creation
* 03/04/2013 DCS51 zwang Handle GFM product
* Sep 03, 2014 3574 njensen Properly dispose objects
*
* </pre>
*
@ -79,11 +79,11 @@ import com.vividsolutions.jts.geom.Coordinate;
public class RadarGraphicsDisplay implements IRenderable {
private Map<Integer, RadarGraphicsPage> pageMap;
private final Map<Integer, RadarGraphicsPage> pageMap;
private ArrayList<RadarGraphicsPage> symbologyPages;
private final ArrayList<RadarGraphicsPage> symbologyPages;
private Map<RadarDataKey, RadarDataPoint> symbologyData;
private final Map<RadarDataKey, RadarDataPoint> symbologyData;
private int currentPage;
@ -108,9 +108,9 @@ public class RadarGraphicsDisplay implements IRenderable {
this.currentPage = 0;
// Only retrieve if this record has not been retrieved.
if ((radarRecord.getSymbologyData() == null || radarRecord
if (((radarRecord.getSymbologyData() == null) || radarRecord
.getSymbologyData().isEmpty())
&& radarRecord.getGraphicBlock() == null) {
&& (radarRecord.getGraphicBlock() == null)) {
File loc = HDF5Util.findHDF5Location(radarRecord);
IDataStore dataStore = DataStoreFactory.getDataStore(loc);
@ -137,7 +137,8 @@ public class RadarGraphicsDisplay implements IRenderable {
IWireframeShape ws = target.createWireframeShape(true, mapDescriptor);
// Used for GFM forecast positions
IWireframeShape gfmWs = target.createWireframeShape(true, mapDescriptor);
IWireframeShape gfmWs = target
.createWireframeShape(true, mapDescriptor);
symbologyData = radarRecord.getSymbologyData();
if (symbologyData != null) {
@ -249,7 +250,8 @@ public class RadarGraphicsDisplay implements IRenderable {
}
}
if ((symbologyData == null || symbologyData.isEmpty()) && gb == null) {
if (((symbologyData == null) || symbologyData.isEmpty())
&& (gb == null)) {
String nullLegend = null;
switch (radarRecord.getProductCode()) {
case 139:
@ -295,7 +297,7 @@ public class RadarGraphicsDisplay implements IRenderable {
String[] values = sortValues.trim().split("\\s+");
if (values.length > 0 && values[0].length() > 1) {
if ((values.length > 0) && (values[0].length() > 1)) {
try {
strengthRank = Integer.parseInt(values[0].substring(1,
values[0].length()));
@ -340,13 +342,17 @@ public class RadarGraphicsDisplay implements IRenderable {
}
public void setMagnification(double magnification) {
synchronized (symbologyPages) {
for (RadarGraphicsPage page : symbologyPages) {
page.setMagnification(magnification);
}
}
synchronized (pageMap) {
for (RadarGraphicsPage page : pageMap.values()) {
page.setMagnification(magnification);
}
}
}
/*
* (non-Javadoc)
@ -358,7 +364,8 @@ public class RadarGraphicsDisplay implements IRenderable {
@Override
public void paint(IGraphicsTarget target, PaintProperties paintProps)
throws VizException {
if (currentPage < 0 || currentPage >= this.pageMap.size()) {
synchronized (pageMap) {
if ((currentPage < 0) || (currentPage >= this.pageMap.size())) {
return;
}
@ -366,8 +373,11 @@ public class RadarGraphicsDisplay implements IRenderable {
if (page == null) {
return;
}
page.paint(target, paintProps);
page.paint(target, paintProps);
}
synchronized (symbologyPages) {
for (RadarGraphicsPage currPage : symbologyPages) {
if (currPage == null) {
return;
@ -376,15 +386,28 @@ public class RadarGraphicsDisplay implements IRenderable {
currPage.paint(target, paintProps);
}
}
}
public int getNumPages() {
synchronized (pageMap) {
return this.pageMap.size() > 0 ? this.pageMap.size() : 1;
}
}
public void dispose() {
synchronized (pageMap) {
for (RadarGraphicsPage page : pageMap.values()) {
page.dispose();
}
pageMap.clear();
}
synchronized (symbologyPages) {
for (RadarGraphicsPage page : symbologyPages) {
page.dispose();
}
symbologyPages.clear();
}
}
private DmdModifier initializeDmdTablePreferences() {

View file

@ -120,6 +120,7 @@ import com.vividsolutions.jts.geom.LineString;
* 03/05/2013 DCS51 zwang Handle GFM product
* 06/24/2013 DR16162 zwang Remove "wind behind"
* 11/20/2013 2488 randerso Removed use of VeraMono font file
* Sep 03, 2014 3574 njensen Properly dispose objects
*
* </pre>
*
@ -1456,6 +1457,21 @@ public class RadarGraphicsPage implements IRenderable {
this.wireframeShape = null;
}
if (this.gfmFcstWireframeShape != null) {
this.gfmFcstWireframeShape.dispose();
this.gfmFcstWireframeShape = null;
}
if (plotObjects != null) {
for (PlotObject po : plotObjects) {
if (po != null) {
po.image.dispose();
po.image = null;
}
}
plotObjects.clear();
}
if (this.font != null) {
this.font.dispose();
}

View file

@ -76,7 +76,8 @@ import com.vividsolutions.jts.geom.Polygon;
* Jul 17, 2014 3419 jsanchez Initial creation
* Aug 20, 2014 ASM #16703 D. Friedman Ensure watches have a state attribute.
* Aug 28, 2014 ASM #15658 D. Friedman Add marine zones.
* Aug 29, 2014 ASM #15551 Qinglu Lin Sorting watches by ETN in processRecords().
* Aug 29, 2014 ASM #15551 Qinglu Lin Sort watches by ETN and filter out ActiveTableRecord
* with act of CAN and EXP in processRecords().
*
* </pre>
*
@ -360,6 +361,9 @@ public class WatchUtil {
Map<Watch, List<String>> map = new HashMap<Watch, List<String>>();
// For each watch event, get the end time and list of active zones
for (ActiveTableRecord ar : activeTableRecords) {
if (ar.getAct().equals("CAN") || ar.getAct().equals("EXP")) {
continue;
}
/*
* Currently reports all zones in the watch even if a given zone is
* not in the warning polygon. If the logic is changed to only show

View file

@ -127,6 +127,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
* 07/10/2014 3370 mpduff Fix update/insert issue for riverstatus
* 07/14/2014 mpduff Fix data range checks
* 08/05/2014 15671 snaples Fixed check for posting when not found in ingestfilter and token is set for load_shef_ingest
* 09/03/2014 mpduff Fixed river status table updates.
* </pre>
*
* @author mduff
@ -1057,23 +1058,23 @@ public class PostShef {
+ "] to commentValue table");
}
}
} // for
/*
* if we just received some forecast height or discharge data,
* then update the riverstatus table for those reports
*/
postTables.executeBatchUpdates();
if (!dataValues.isEmpty()) {
ShefData data = dataValues.get(0);
DataType dataType = ParameterCode.DataType.getDataType(
data.getTypeSource(), procObs);
if ((DataType.FORECAST.equals(dataType))
&& loadMaxFcst
&& (data.getPhysicalElement().getCode().startsWith("H") || data
.getPhysicalElement().getCode().startsWith("Q"))) {
postRiverStatus(data, locId);
if (!same_lid_product) {
log.info("Update RiverStatus for: " + locId + " " + pe);
log.info("Update RiverStatus for: " + locId + " "
+ data.getPhysicalElement().getCode());
}
}
} // for
postTables.executeBatchUpdates();
} catch (Exception e) {
log.error("An error occurred posting shef data.", e);
}
@ -1678,7 +1679,8 @@ public class PostShef {
private void convertDur(short dur, ShefData data) {
String value = null;
String durationCode = null;
value = DURATION_MAP.get(dur);
Integer durInt = new Integer(dur);
value = DURATION_MAP.get(durInt);
if (value == null) {
// Anything not in the DURATION_MAP is
// probably a variable duration.

View file

@ -86,6 +86,7 @@ import com.raytheon.uf.edex.database.dao.DaoConfig;
* 09/19/2013 16515 w. Kwock Fix the excessive digits in rawpp,lake,height...tables
* 04/29/2014 3088 mpduff Change logging class, clean up/optimization.
* More performance fixes.
* 09/03/2014 mpduff postRiverStatus() writes directly, not via batch
*
* </pre>
*
@ -123,10 +124,6 @@ public class PostTables {
private Map<String, CallableStatement> statementMap = new HashMap<String, CallableStatement>();
private PreparedStatement riverStatusUpdateStatement = null;
private PreparedStatement riverStatusInsertStatement = null;
static {
gagePPSetup();
}
@ -1222,10 +1219,11 @@ public class PostTables {
String ts = null;
float probability = -9999;
int status = -1;
PreparedStatement ps = null;
try {
conn = getConnection();
PreparedStatement ps = getRiverStatusPreparedStatement(updateFlag);
ps = getRiverStatusPreparedStatement(updateFlag);
lid = shefDataValue.getLocationId();
ps.setString(1, lid);
@ -1258,7 +1256,6 @@ public class PostTables {
timeStamp2 = new java.sql.Timestamp(basisDate.getTime());
ps.setTimestamp(8, timeStamp2);
// ps.setFloat(9, Float.parseFloat(shefDataValue.getStringValue()));
ps.setDouble(9, shefDataValue.getValue().floatValue());
if (updateFlag) {
@ -1266,7 +1263,8 @@ public class PostTables {
ps.setString(11, pe);
ps.setString(12, ts);
}
ps.addBatch();
ps.execute();
conn.commit();
} catch (Exception e) {
if (updateFlag) {
log.error(String.format(
@ -1276,6 +1274,16 @@ public class PostTables {
"Error inserting into RiverStatus with [%s]", record),
e);
}
} finally {
if (ps != null) {
try {
ps.close();
} catch (SQLException e) {
log.error(
"Error closing prepared statement for RiverStatus",
e);
}
}
}
return status;
@ -1284,16 +1292,12 @@ public class PostTables {
private PreparedStatement getRiverStatusPreparedStatement(boolean updateFlag)
throws SQLException {
if (updateFlag) {
if (riverStatusUpdateStatement == null) {
riverStatusUpdateStatement = conn
PreparedStatement riverStatusUpdateStatement = conn
.prepareCall(RIVER_STATUS_UPDATE_STATEMENT);
}
return riverStatusUpdateStatement;
} else {
if (riverStatusInsertStatement == null) {
riverStatusInsertStatement = conn
PreparedStatement riverStatusInsertStatement = conn
.prepareCall(RIVER_STATUS_INSERT_STATEMENT);
}
return riverStatusInsertStatement;
}
}
@ -1314,26 +1318,6 @@ public class PostTables {
* Close the connections and statements
*/
public void close() {
if (riverStatusInsertStatement != null) {
try {
riverStatusInsertStatement.close();
} catch (SQLException e) {
log.error(
"Error closing river status insert prepared statement",
e);
}
}
if (riverStatusUpdateStatement != null) {
try {
riverStatusUpdateStatement.close();
} catch (SQLException e) {
log.error(
"Error closing river status update prepared statement",
e);
}
}
for (String functionName : statementMap.keySet()) {
CallableStatement cs = statementMap.get(functionName);
try {
@ -1356,28 +1340,6 @@ public class PostTables {
*
*/
public void executeBatchUpdates() {
try {
if (riverStatusUpdateStatement != null) {
riverStatusUpdateStatement.execute();
conn.commit();
riverStatusUpdateStatement.close();
riverStatusUpdateStatement = null;
}
} catch (SQLException e) {
log.error("An error occurred storing river status updates", e);
}
try {
if (riverStatusInsertStatement != null) {
riverStatusInsertStatement.execute();
conn.commit();
riverStatusInsertStatement.close();
riverStatusInsertStatement = null;
}
} catch (SQLException e) {
log.error("An error occurred inserting river status values", e);
}
for (String key : statementMap.keySet()) {
CallableStatement cs = statementMap.get(key);
try {