Issue #1475 QPF standalonoe displays appear slow

Change-Id: I352de7f76ade5d3d981b3c6206086955c2243f6a

Former-commit-id: 2f6bf58b35e6ff8317281c3e62d1c1a61eea14f0
This commit is contained in:
Dave Hladky 2013-01-14 11:27:26 -06:00
parent 061fa21537
commit 75f62b0856
3 changed files with 47 additions and 33 deletions

View file

@ -53,6 +53,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.HDF5Util;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
@ -88,6 +89,7 @@ import com.raytheon.uf.viz.monitor.listeners.IMonitorListener;
* ------------ ---------- ----------- --------------------------
* 04/03/10 4494 D. Hladky Initial release
* 12/07/12 1353 rferrel Changes for non-blocking FFMPSplash.
* 01/10/13 1475 D. Hladky Cleaned up some logging.
*
* </pre>
*
@ -694,7 +696,7 @@ public class FFMPMonitor extends ResourceMonitor {
if (source.getSourceType().equals(
SOURCE_TYPE.GUIDANCE.getSourceType())) {
long timeOffset = source.getExpirationMinutes(siteKey) * 1000 * 60;
long timeOffset = source.getExpirationMinutes(siteKey) * TimeUtil.MILLIS_PER_MINUTE;
earliestTime = new Date(time.getTime() - timeOffset);
}
@ -977,7 +979,7 @@ public class FFMPMonitor extends ResourceMonitor {
hucsToLoad.clear();
hucsToLoad.add("ALL");
timeBack = new Date(resource.getMostRecentTime().getTime()
- (3600 * 1000 * 24));
- (TimeUtil.MILLIS_PER_HOUR * 24));
}
frd.floader = new FFMPDataLoader(frd, timeBack, startTime, loadType,
@ -1149,10 +1151,13 @@ public class FFMPMonitor extends ResourceMonitor {
res.getResourceData().floader = null;
int val = siteCount.get(res.getSiteKey());
// clear out the cache
for (Entry<String, FFMPCacheRecord> entry : ffmpData.get(
res.getSiteKey()).entrySet()) {
entry.getValue().closeCache();
// never opened a cache
if (ffmpData.get(res.getSiteKey()) != null) {
// clear out the cache
for (Entry<String, FFMPCacheRecord> entry : ffmpData.get(
res.getSiteKey()).entrySet()) {
entry.getValue().closeCache();
}
}
if ((val == 1) && (siteCount.size() > 1)) {
@ -2426,9 +2431,11 @@ public class FFMPMonitor extends ResourceMonitor {
}
} else {
try {
statusHandler.handle(Priority.INFO,
if (statusHandler.isPriorityEnabled(Priority.DEBUG)) {
statusHandler.handle(Priority.DEBUG,
"Retrieving and Populating URI: , "
+ dataUri);
}
curRecord.retrieveMapFromDataStore(dataStore,
dataUri,
getTemplates(fffmpRec.getSiteKey()), fhuc,

View file

@ -81,6 +81,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.IGraphicsTarget;
@ -152,6 +153,7 @@ import com.vividsolutions.jts.geom.Point;
* 31 July 2012 14517 mpduff Fix for blanking map on update.
* 14 Sep 2012 1048 njensen Code cleanup
* 07 Dec 2012 1353 rferrel Changes for non-blocking FFMPSplash dialog.
* 10 Jan 2103 1475 dhladky Some cleanup
*
* </pre>
*
@ -2070,6 +2072,7 @@ public class FFMPResource extends
private void drawSquare(PixelCoverage pc, IGraphicsTarget target)
throws VizException {
//target.drawLine(lines)
target.drawLine(pc.getLl().x, pc.getLl().y, 0.0, pc.getUl().x, pc
.getUl().y, 0.0, getCapability(ColorableCapability.class)
.getColor(), getCapability(OutlineCapability.class)
@ -2455,10 +2458,6 @@ public class FFMPResource extends
cwaBasins.clear();
try {
// String aggrHuc = "HUC0";
// if (phuc.equals("COUNTY")) {
// aggrHuc = phuc;
// }
// use the envelopes from HUC0 to speed processing
// if necessary
Map<Long, Envelope> envMap = hucGeomFactory.getEnvelopes(
@ -2472,7 +2471,7 @@ public class FFMPResource extends
}
}
} catch (Exception e) {
statusHandler.handle(Priority.WARN, "Domain: " + cwa
statusHandler.handle(Priority.DEBUG, "Domain: " + cwa
+ " Outside of site: " + getSiteKey() + " area...");
}
}
@ -2901,7 +2900,7 @@ public class FFMPResource extends
descriptor, 0.0f);
if (req.shaded) {
localShadedShape = req.target.createShadedShape(false,
descriptor, true);
descriptor.getGridGeometry(), true);
}
JTSCompiler jtsCompiler2 = new JTSCompiler(localShadedShape,
@ -3550,7 +3549,7 @@ public class FFMPResource extends
synchronized (tableTime) {
Date recentTime = getMostRecentTime();
long time = new Double(recentTime.getTime() - (1000 * 3600)
long time = new Double(recentTime.getTime() - (TimeUtil.MILLIS_PER_HOUR)
* getTime()).longValue();
Date date = new Date();
date.setTime(time);
@ -3724,7 +3723,7 @@ public class FFMPResource extends
Date oldestCurrentTime = getResourceData().getAvailableTimes()[0]
.getRefTime();
Date oldestTime = new Date(oldestCurrentTime.getTime()
- (1000 * 3600 * 24));
- (TimeUtil.MILLIS_PER_HOUR * 24));
SortedSet<Date> keys = monitor.getAvailableUris(getSiteKey(),
getDataKey(), getPrimarySource(), oldestTime).keySet();
@ -3771,7 +3770,7 @@ public class FFMPResource extends
- getTableTime().getTime();
sliderTime = Math
.floor(4 * (offset.doubleValue() / (1000 * 3600)) + .25) / 4;
.floor(4 * (offset.doubleValue() / (TimeUtil.MILLIS_PER_HOUR)) + .25) / 4;
// sliderTime = Math.floor(((offset.doubleValue() / (1000 * 3600)) +
// .005) * 100) / 100;
setTime(sliderTime);
@ -4010,7 +4009,7 @@ public class FFMPResource extends
this.qpeSourceExpiration = monitor.getSourceConfig()
.getSource(resourceData.getPrimarySource())
.getExpirationMinutes(getSiteKey()) * 60 * 1000;
.getExpirationMinutes(getSiteKey()) * TimeUtil.MILLIS_PER_MINUTE;
}
return qpeSourceExpiration;
}
@ -4033,7 +4032,7 @@ public class FFMPResource extends
source = FFMPSourceConfigurationManager.getInstance()
.getSource(getResourceData().sourceName);
}
qpfSourceExpiration = source.getExpirationMinutes(getSiteKey()) * 60 * 1000;
qpfSourceExpiration = source.getExpirationMinutes(getSiteKey()) * TimeUtil.MILLIS_PER_MINUTE;
}
return qpfSourceExpiration;
}
@ -4056,12 +4055,12 @@ public class FFMPResource extends
SourceXML source = getProduct().getGuidanceSourcesByType(
guidSrc).get(0);
guidSourceExpiration = source
.getExpirationMinutes(getSiteKey()) * 60 * 1000;
.getExpirationMinutes(getSiteKey()) * TimeUtil.MILLIS_PER_MINUTE;
} else {
guidSourceExpiration = monitor.getSourceConfig()
.getSource(resourceData.getPrimarySource())
.getExpirationMinutes(getSiteKey()) * 60 * 1000;
.getExpirationMinutes(getSiteKey()) * TimeUtil.MILLIS_PER_MINUTE;
}
}
@ -4266,7 +4265,7 @@ public class FFMPResource extends
}
return 3600 * 24 * 1000;
return 24 * TimeUtil.MILLIS_PER_HOUR;
}
/**
@ -4281,7 +4280,7 @@ public class FFMPResource extends
if (status.isDone() && !this.getResourceData().isTertiaryLoad) {
try {
Date startDate = new Date(getMostRecentTime().getTime()
- (6 * 3600 * 1000));
- (6 * TimeUtil.MILLIS_PER_HOUR));
FFMPMonitor.getInstance().startLoad(this, startDate,
LOADER_TYPE.TERTIARY);
} catch (VizException e) {

View file

@ -50,6 +50,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractNameGenerator;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
@ -230,11 +231,8 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
DataTime mostRecentTime = availableTimes[availableTimes.length - 1];
this.timeBack = new Date(
(long) (mostRecentTime.getRefTime().getTime() - (cfgBasinXML
.getTimeFrame() * 3600 * 1000)));
.getTimeFrame() * TimeUtil.MILLIS_PER_HOUR)));
ArrayList<String> hucsToLoad = monitor.getTemplates(siteKey).getTemplateMgr().getHucLevels();
//ArrayList<String> hucsToLoad = new ArrayList<String>();
//hucsToLoad.add(cfgBasinXML.getLayer());
//hucsToLoad.add("ALL");
// goes back X hours and pre populates the Data Hashes
FFMPDataLoader loader = new FFMPDataLoader(this, timeBack,
mostRecentTime.getRefTime(), LOADER_TYPE.INITIAL,
@ -275,18 +273,28 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
this.domains = monitor.getRunConfig().getDomains();
SourceXML source = monitor.getSourceConfig().getSource(
sourceName);
Date standAloneTime = null;
if (source != null) {
// Special Loading for guidance sources, as mentioned in the comment
if (source.getDataType().equals(SOURCE_TYPE.GUIDANCE.getSourceType())) {
long oldestTime = availableTimes[0].getRefTime()
.getTime();
long expirationTime = source
.getExpirationMinutes(siteKey) * TimeUtil.MILLIS_PER_MINUTE;
standAloneTime = new Date(oldestTime
- expirationTime);
} else {
// Only load current frames time
standAloneTime = availableTimes[availableTimes.length - 1]
.getRefTime();
}
long oldestTime = availableTimes[0].getRefTime().getTime();
long expirationTime = source.getExpirationMinutes(siteKey) * 60 * 1000;
Date standAloneTime = new Date(oldestTime - expirationTime);
NavigableMap<Date, List<String>> sourceURIs = getMonitor()
.getAvailableUris(siteKey, dataKey, sourceName,
standAloneTime);
.getAvailableUris(siteKey, dataKey, sourceName,
standAloneTime);
getMonitor().processUris(sourceURIs, false, siteKey,
sourceName, standAloneTime, "ALL");
sourceName, standAloneTime, "ALL");
}
}
}