Merge "Omaha #3077 Cache logic fix Change-Id: Iea128331728b318ecd85b1e95848c1ff181386a8" into omaha_15.1.1
Former-commit-id: 14d70e5c7d5bd875c8a2edb3cba77685e86adda4
This commit is contained in:
commit
bf39bfd680
3 changed files with 34 additions and 38 deletions
|
@ -46,6 +46,7 @@ import com.raytheon.uf.edex.database.plugin.PluginFactory;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 06/22/09 2152 D. Hladky Initial release
|
||||
* Apr 24, 2014 2060 njensen Updates for removal of grid dataURI column
|
||||
* 09 Feb 2015 3077 dhladky Updated cache logic
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -136,41 +137,55 @@ public class DATUtils {
|
|||
|
||||
try {
|
||||
ScanDataCache cache = ScanDataCache.getInstance();
|
||||
/*
|
||||
* TODO njensen: we should only spend time populating if the new rec
|
||||
* replaces the old rec. Delaying that change as at present as I'm
|
||||
* just trying to make it work the same as before.
|
||||
*/
|
||||
populateGridRecord(newRec);
|
||||
|
||||
// if this is true, existing grid is in the cache.
|
||||
if (cache.getModelData().isType(param.getModelName(),
|
||||
param.getParameterName())) {
|
||||
// get the old record for comparison
|
||||
GridRecord oldRec = cache.getModelData().getGridRecord(
|
||||
param.getModelName(), param.getParameterName());
|
||||
|
||||
if (newRec != null) {
|
||||
if (newRec.getDataTime().getRefTime()
|
||||
.after(oldRec.getDataTime().getRefTime())) {
|
||||
// fully populate the new record
|
||||
populateGridRecord(newRec);
|
||||
// insert new record
|
||||
cache.getModelData().setGridRecord(
|
||||
param.getModelName(), param.getParameterName(),
|
||||
newRec);
|
||||
// new record replaces old record.
|
||||
rec = newRec;
|
||||
} else {
|
||||
// old record is the same time as new
|
||||
rec = oldRec;
|
||||
}
|
||||
} else {
|
||||
// new record is null, do not overwrite
|
||||
rec = oldRec;
|
||||
}
|
||||
// if you get here this means that no grid exists in cache currently
|
||||
} else {
|
||||
// new record is good, insert it
|
||||
if (newRec != null) {
|
||||
// fully populate new record
|
||||
populateGridRecord(newRec);
|
||||
// insert new record
|
||||
cache.getModelData().setGridRecord(
|
||||
param.getModelName(), param.getParameterName(),
|
||||
newRec);
|
||||
rec = newRec;
|
||||
// no records for this grid exist at all
|
||||
} else {
|
||||
rec = oldRec;
|
||||
}
|
||||
} else {
|
||||
rec = oldRec;
|
||||
}
|
||||
} else {
|
||||
if (newRec != null) {
|
||||
cache.getModelData().setGridRecord(param.getModelName(),
|
||||
param.getParameterName(), newRec);
|
||||
rec = newRec;
|
||||
logger.warn("No record(s) found matching these criteria. Model:"
|
||||
+ param.getModelName()
|
||||
+ " Param:"
|
||||
+ param.getParameterName() + " Interval:" + interval);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in retrieval: " + param.getModelName() + ": "
|
||||
+ param.getParameterName() + " record: " + newRec);
|
||||
logger.error("Error in grid retrieval: " + param.getModelName() + ": "
|
||||
+ param.getParameterName() + " record: " + newRec, e);
|
||||
}
|
||||
|
||||
return rec;
|
||||
|
|
|
@ -66,6 +66,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* 06/02/2009 2037 dhladky Initial Creation.
|
||||
* Apr 24, 2014 2060 njensen Updates for removal of grid dataURI column
|
||||
* May 12, 2014 3133 njensen Use LightningRetriever instead of ScanUtils
|
||||
* Feb 09, 2105 3077 dhladky Fixed underlying cache logic.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -566,27 +567,16 @@ public class CWATConfig {
|
|||
|
||||
int interval = TimeUtil.MINUTES_PER_DAY;
|
||||
|
||||
/*
|
||||
* FIXME the inner calls to ####Product.getGridProduct below
|
||||
* will always return null. The second parameter is supposed to
|
||||
* be the model (e.g. RUC130) but is passing in the parameter.
|
||||
*
|
||||
* Despite this problem, the code continues to function without
|
||||
* exceptions because the call to
|
||||
* DATUtils.getMostRecentGridRecord() will see the null record
|
||||
* and then return the cached record, which was retrieved
|
||||
* correctly.
|
||||
*/
|
||||
u700 = DATUtils.getMostRecentGridRecord(interval,
|
||||
U700Product.getGridRecord(interval, U700Product.U700),
|
||||
U700Product.getGridRecord(interval, param700U.getModelName()),
|
||||
param700U);
|
||||
|
||||
v700 = DATUtils.getMostRecentGridRecord(interval,
|
||||
V700Product.getGridRecord(interval, V700Product.V700),
|
||||
V700Product.getGridRecord(interval, param700V.getModelName()),
|
||||
param700V);
|
||||
|
||||
u500 = DATUtils.getMostRecentGridRecord(interval,
|
||||
U500Product.getGridRecord(interval, U500Product.U500),
|
||||
U500Product.getGridRecord(interval, param500U.getModelName()),
|
||||
param500U);
|
||||
|
||||
if (u700 != null && v700 != null && u500 != null) {
|
||||
|
|
|
@ -64,6 +64,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* 01/07/2013 DR 15647 gzhang Use logger.warn for null earlyVilURI/earlyCZURI.
|
||||
* 11/11/2013 2377 bclement setRadarRecords returns bool for success
|
||||
* Apr 24, 2014 2060 njensen Updates for removal of grid dataURI column
|
||||
* Feb 09, 2105 3077 dhladky Fixed underlying cache logic.
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
|
@ -548,22 +549,12 @@ public class QPFConfig {
|
|||
|
||||
int interval = TimeUtil.MINUTES_PER_DAY;
|
||||
|
||||
/*
|
||||
* FIXME the inner calls to ####Product.getGridProduct below will
|
||||
* always return null. The second parameter is supposed to be the
|
||||
* model (e.g. RUC130) but is passing in the parameter.
|
||||
*
|
||||
* Despite this problem, the code continues to function without
|
||||
* exceptions because the call to DATUtils.getMostRecentGridRecord()
|
||||
* will see the null record and then return the cached record, which
|
||||
* was retrieved correctly.
|
||||
*/
|
||||
GridRecord modelURec = DATUtils.getMostRecentGridRecord(interval,
|
||||
U700Product.getGridRecord(interval, U700Product.U700),
|
||||
U700Product.getGridRecord(interval, paramXMLU.getModelName()),
|
||||
paramXMLU);
|
||||
|
||||
GridRecord modelVRec = DATUtils.getMostRecentGridRecord(interval,
|
||||
V700Product.getGridRecord(interval, V700Product.V700),
|
||||
V700Product.getGridRecord(interval, paramXMLV.getModelName()),
|
||||
paramXMLV);
|
||||
|
||||
if (modelURec != null && modelVRec != null) {
|
||||
|
|
Loading…
Add table
Reference in a new issue