Merge branch 'development' of ssh://lightning.omaha.us.ray.com:29418/AWIPS2_baseline into development
Former-commit-id:302aa05586
[formerlyde9034c96c
] [formerly302aa05586
[formerlyde9034c96c
] [formerly4688ac304f
[formerly d2a398126648eaf391ddf39f99a77c0f40d08618]]] Former-commit-id:4688ac304f
Former-commit-id:f2ab9cfe1a
[formerlyb82d6772c3
] Former-commit-id:acfc6eff55
This commit is contained in:
commit
05082b1d3a
29 changed files with 678 additions and 437 deletions
|
@ -42,7 +42,6 @@ import com.raytheon.uf.common.pointdata.PointDataDescription.Type;
|
|||
import com.raytheon.uf.common.pointdata.PointDataView;
|
||||
import com.raytheon.uf.common.time.BinOffset;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
|
||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
||||
import com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter;
|
||||
|
@ -99,7 +98,8 @@ public class CoopPrecipDataCubeAdapter implements IDataCubeAdapter {
|
|||
ffgDescription.parameters[6] = new ParameterDescription("stationId",
|
||||
Type.STRING);
|
||||
ffgDescription.parameters[7] = new ParameterDescription("id", Type.INT);
|
||||
ffgDescription.parameters[8] = new ParameterDescription("dataURI", Type.STRING);
|
||||
ffgDescription.parameters[8] = new ParameterDescription("dataURI",
|
||||
Type.STRING);
|
||||
|
||||
rtpDescription.parameters = new ParameterDescription[7];
|
||||
rtpDescription.parameters[0] = new ParameterDescription("time",
|
||||
|
@ -113,7 +113,8 @@ public class CoopPrecipDataCubeAdapter implements IDataCubeAdapter {
|
|||
rtpDescription.parameters[4] = new ParameterDescription("stationId",
|
||||
Type.STRING);
|
||||
rtpDescription.parameters[5] = new ParameterDescription("id", Type.INT);
|
||||
rtpDescription.parameters[6] = new ParameterDescription("dataURI", Type.STRING);
|
||||
rtpDescription.parameters[6] = new ParameterDescription("dataURI",
|
||||
Type.STRING);
|
||||
|
||||
}
|
||||
|
||||
|
@ -128,7 +129,6 @@ public class CoopPrecipDataCubeAdapter implements IDataCubeAdapter {
|
|||
List<List<DataTime>> results = new ArrayList<List<DataTime>>(
|
||||
requests.size());
|
||||
for (TimeQueryRequest request : requests) {
|
||||
request.setSimDate(SimulatedTime.getSystemTime().getTime());
|
||||
DataTime[] result = timeQuery(request.getQueryTerms(),
|
||||
request.isMaxQuery(), request.getBinOffset());
|
||||
if (result != null) {
|
||||
|
@ -243,7 +243,8 @@ public class CoopPrecipDataCubeAdapter implements IDataCubeAdapter {
|
|||
pdv.setFloat("3hr", Float.valueOf(parts[1]));
|
||||
pdv.setFloat("6hr", Float.valueOf(parts[2]));
|
||||
pdv.setString("stationId", station);
|
||||
pdv.setString("dataURI", "/textPoints/" + station + "/" + time);
|
||||
pdv.setString("dataURI", "/textPoints/" + station + "/"
|
||||
+ time);
|
||||
// TODO this id is not really guaranteed to be unique
|
||||
pdv.setInt("id", ((int) time) + station.hashCode());
|
||||
}
|
||||
|
@ -321,7 +322,8 @@ public class CoopPrecipDataCubeAdapter implements IDataCubeAdapter {
|
|||
pdv.setFloat("latitude", (float) coord.latlon.y);
|
||||
pdv.setFloat("precip", precip);
|
||||
pdv.setString("stationId", station);
|
||||
pdv.setString("dataURI", "/textPoints/" + station + "/" + time);
|
||||
pdv.setString("dataURI", "/textPoints/" + station + "/"
|
||||
+ time);
|
||||
// TODO this id is not really guaranteed to be unique
|
||||
pdv.setInt("id", ((int) time) + station.hashCode());
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.BinOffset;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
import com.raytheon.uf.viz.core.comm.Connector;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
|
@ -233,7 +232,6 @@ public class CatalogQuery {
|
|||
req.setMaxQuery(max);
|
||||
req.setPluginName(pluginName);
|
||||
req.setBinOffset(binOffset);
|
||||
req.setSimDate(SimulatedTime.getSystemTime().getTime());
|
||||
req.setQueryTerms(constraintMap);
|
||||
|
||||
return req;
|
||||
|
|
|
@ -31,7 +31,6 @@ import com.raytheon.uf.common.datastorage.Request;
|
|||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
||||
import com.raytheon.uf.viz.core.catalog.ScriptCreator;
|
||||
import com.raytheon.uf.viz.core.comm.Loader;
|
||||
|
@ -88,11 +87,7 @@ public class DefaultDataCubeAdapter implements IDataCubeAdapter {
|
|||
throws VizException {
|
||||
TimeQueryRequestSet set = new TimeQueryRequestSet();
|
||||
set.setRequests(requests.toArray(new TimeQueryRequest[0]));
|
||||
// boundary for time queries
|
||||
for (TimeQueryRequest req: set.getRequests()) {
|
||||
req.setSimDate(SimulatedTime.getSystemTime().getTime());
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<List<DataTime>> result = (List<List<DataTime>>) ThriftClient
|
||||
.sendRequest(set);
|
||||
|
|
|
@ -43,7 +43,6 @@ import com.raytheon.uf.common.datastorage.Request;
|
|||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
||||
import com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter;
|
||||
import com.raytheon.uf.viz.core.datastructure.VizDataCubeException;
|
||||
|
@ -109,7 +108,6 @@ public abstract class AbstractDataCubeAdapter implements IDataCubeAdapter {
|
|||
for (TimeQueryRequest request : requests) {
|
||||
List<AbstractRequestableLevelNode> requestNodes = evaluateRequestConstraints(request
|
||||
.getQueryTerms());
|
||||
request.setSimDate(SimulatedTime.getSystemTime().getTime());
|
||||
// pull out time queries and bulk submit
|
||||
for (AbstractRequestableLevelNode requestNode : requestNodes) {
|
||||
getTimeQuery(request, requestNode, false, queries, cache, null);
|
||||
|
@ -178,8 +176,6 @@ public abstract class AbstractDataCubeAdapter implements IDataCubeAdapter {
|
|||
TimeQueryRequest myQ = req.getTimeQuery(originalRequest,
|
||||
latestOnly, cache, latestOnlyCache);
|
||||
if (myQ != null) {
|
||||
// Make sure simulated time gets set
|
||||
myQ.setSimDate(originalRequest.getSimDate());
|
||||
queries.put(req, myQ);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -35,7 +35,6 @@ import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
|
|||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.rsc.URICatalog;
|
||||
|
@ -123,7 +122,6 @@ public class ThinClientURICatalog extends URICatalog implements
|
|||
TimeQueryRequest request = new TimeQueryRequest();
|
||||
request.setPluginName(pluginName);
|
||||
request.setMaxQuery(true);
|
||||
request.setSimDate(SimulatedTime.getSystemTime().getTime());
|
||||
request.setQueryTerms(map);
|
||||
List<TimeQueryRequest> requestList = requests.get(pluginName);
|
||||
if (requestList == null) {
|
||||
|
|
|
@ -107,109 +107,110 @@ public class AutoUpdater implements IAlertObserver {
|
|||
public AutoUpdater() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void alertArrived(Collection<AlertMessage> alertMessages) {
|
||||
Set<IDescriptor> displayList = new HashSet<IDescriptor>();
|
||||
Map<AbstractRequestableResourceData, List<Object>> pdoSendMap = new IdentityHashMap<AbstractRequestableResourceData, List<Object>>();
|
||||
int errors = 0;
|
||||
@Override
|
||||
public void alertArrived(Collection<AlertMessage> alertMessages) {
|
||||
Set<IDescriptor> displayList = new HashSet<IDescriptor>();
|
||||
Map<AbstractRequestableResourceData, List<Object>> pdoSendMap = new IdentityHashMap<AbstractRequestableResourceData, List<Object>>();
|
||||
int errors = 0;
|
||||
|
||||
for (AlertMessage message : alertMessages) {
|
||||
Map<String, Object> attribs = message.decodedAlert;
|
||||
DataTime dataTime = (DataTime) attribs.get("dataTime");
|
||||
if (dataTime.getRefTime().before(
|
||||
SimulatedTime.getSystemTime().getTime())) {
|
||||
try {
|
||||
// System.out.println("extract took: " + (tZ1 - tZ0));
|
||||
java.util.List<AbstractVizResource<?, ?>> rscList = DataUpdateTree
|
||||
.getInstance().searchTree(attribs);
|
||||
// System.out.println("AutoUpdater found: " + rscList);
|
||||
for (AlertMessage message : alertMessages) {
|
||||
Map<String, Object> attribs = message.decodedAlert;
|
||||
DataTime dataTime = (DataTime) attribs.get("dataTime");
|
||||
if (dataTime.getRefTime().before(
|
||||
SimulatedTime.getSystemTime().getTime())) {
|
||||
try {
|
||||
// System.out.println("extract took: " + (tZ1 - tZ0));
|
||||
java.util.List<AbstractVizResource<?, ?>> rscList = DataUpdateTree
|
||||
.getInstance().searchTree(attribs);
|
||||
// System.out.println("AutoUpdater found: " + rscList);
|
||||
|
||||
if (rscList != null && rscList.size() > 0) {
|
||||
if (rscList != null && rscList.size() > 0) {
|
||||
|
||||
for (AbstractVizResource<?, ?> r1 : rscList) {
|
||||
IDescriptor md = r1.getDescriptor();
|
||||
AbstractResourceData resourceData = r1
|
||||
.getResourceData();
|
||||
if (!(resourceData instanceof AbstractRequestableResourceData)
|
||||
|| resourceData.isFrozen())
|
||||
continue;
|
||||
for (AbstractVizResource<?, ?> r1 : rscList) {
|
||||
IDescriptor md = r1.getDescriptor();
|
||||
AbstractResourceData resourceData = r1
|
||||
.getResourceData();
|
||||
if (!(resourceData instanceof AbstractRequestableResourceData)
|
||||
|| resourceData.isFrozen())
|
||||
continue;
|
||||
|
||||
AbstractRequestableResourceData reqResourceData = (AbstractRequestableResourceData) resourceData;
|
||||
AbstractAlertMessageParser parserToUse = null;
|
||||
if ((parserToUse = reqResourceData.getAlertParser()) == null) {
|
||||
parserToUse = defaultParser;
|
||||
}
|
||||
Object objectToSend = parserToUse
|
||||
.parseAlertMessage(message, reqResourceData);
|
||||
AbstractRequestableResourceData reqResourceData = (AbstractRequestableResourceData) resourceData;
|
||||
AbstractAlertMessageParser parserToUse = null;
|
||||
if ((parserToUse = reqResourceData.getAlertParser()) == null) {
|
||||
parserToUse = defaultParser;
|
||||
}
|
||||
Object objectToSend = parserToUse
|
||||
.parseAlertMessage(message, reqResourceData);
|
||||
|
||||
if (objectToSend != null) {
|
||||
if (md.getTimeMatcher() != null) {
|
||||
md.getTimeMatcher().redoTimeMatching(r1);
|
||||
}
|
||||
displayList.add(md);
|
||||
if (objectToSend != null) {
|
||||
if (md.getTimeMatcher() != null) {
|
||||
md.getTimeMatcher().redoTimeMatching(r1);
|
||||
}
|
||||
displayList.add(md);
|
||||
|
||||
List<Object> list = pdoSendMap
|
||||
.get(reqResourceData);
|
||||
if (list == null) {
|
||||
list = new ArrayList<Object>();
|
||||
pdoSendMap.put(reqResourceData, list);
|
||||
}
|
||||
list.add(objectToSend);
|
||||
List<Object> list = pdoSendMap
|
||||
.get(reqResourceData);
|
||||
if (list == null) {
|
||||
list = new ArrayList<Object>();
|
||||
pdoSendMap.put(reqResourceData, list);
|
||||
}
|
||||
list.add(objectToSend);
|
||||
|
||||
if (list.size() > 100) {
|
||||
// update with objects
|
||||
Class<?> componentType = list.get(0)
|
||||
.getClass();
|
||||
reqResourceData.update(list
|
||||
.toArray((Object[]) Array
|
||||
.newInstance(componentType,
|
||||
list.size())));
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
if (list.size() > 100) {
|
||||
// update with objects
|
||||
Class<?> componentType = list.get(0)
|
||||
.getClass();
|
||||
reqResourceData.update(list
|
||||
.toArray((Object[]) Array
|
||||
.newInstance(componentType,
|
||||
list.size())));
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} catch (final Throwable e) {
|
||||
if (errors < MAX_ERRORS) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error performing autoupdate", e);
|
||||
}
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
} catch (final Throwable e) {
|
||||
if (errors < MAX_ERRORS) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error performing autoupdate", e);
|
||||
}
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (AbstractRequestableResourceData arrd : pdoSendMap.keySet()) {
|
||||
List<Object> pdos = pdoSendMap.get(arrd);
|
||||
if (pdos == null || pdos.size() < 1) {
|
||||
continue;
|
||||
}
|
||||
Class<?> componentType = pdos.get(0).getClass();
|
||||
arrd.update(pdos.toArray((Object[]) Array.newInstance(
|
||||
componentType, pdos.size())));
|
||||
}
|
||||
for (AbstractRequestableResourceData arrd : pdoSendMap.keySet()) {
|
||||
List<Object> pdos = pdoSendMap.get(arrd);
|
||||
if (pdos == null || pdos.size() < 1) {
|
||||
continue;
|
||||
}
|
||||
Class<?> componentType = pdos.get(0).getClass();
|
||||
arrd.update(pdos.toArray((Object[]) Array.newInstance(
|
||||
componentType, pdos.size())));
|
||||
}
|
||||
|
||||
List<IDescriptor> refreshedDescriptors = new ArrayList<IDescriptor>();
|
||||
// Now do redo time matching, and refresh displays
|
||||
for (IDescriptor disp : displayList) {
|
||||
if (disp != null && disp.getRenderableDisplay() != null) {
|
||||
IDisplayPaneContainer container = disp
|
||||
.getRenderableDisplay().getContainer();
|
||||
List<IDescriptor> refreshedDescriptors = new ArrayList<IDescriptor>();
|
||||
// Now do redo time matching, and refresh displays
|
||||
for (IDescriptor disp : displayList) {
|
||||
if (disp != null && disp.getRenderableDisplay() != null) {
|
||||
IDisplayPaneContainer container = disp.getRenderableDisplay()
|
||||
.getContainer();
|
||||
if (container == null) {
|
||||
continue;
|
||||
}
|
||||
for (IDisplayPane pane : container.getDisplayPanes()) {
|
||||
IDescriptor desc = pane.getDescriptor();
|
||||
for (IDisplayPane pane : container.getDisplayPanes()) {
|
||||
IDescriptor desc = pane.getDescriptor();
|
||||
|
||||
if (refreshedDescriptors.contains(desc)) {
|
||||
continue;
|
||||
}
|
||||
TimeMatchingJob.scheduleTimeMatch(desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (refreshedDescriptors.contains(desc)) {
|
||||
continue;
|
||||
}
|
||||
TimeMatchingJob.scheduleTimeMatch(desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,287 @@
|
|||
/**
|
||||
* 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.viz.core.gl;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.media.opengl.GL;
|
||||
|
||||
import com.raytheon.viz.core.gl.internal.cache.ImageCache;
|
||||
import com.raytheon.viz.core.gl.internal.cache.ImageCache.CacheType;
|
||||
|
||||
/**
|
||||
*
|
||||
* Provides method for tracking graphics memory useage and logging if it becomes
|
||||
* low.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 19, 2012 bsteffen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bsteffen
|
||||
* @version 1.0
|
||||
*/
|
||||
public class GLStats {
|
||||
|
||||
// how many seconds to wait before checking for high memory usage.
|
||||
private static final int CHECK_FREQ_SECONDS = 15;
|
||||
|
||||
// How many seconds to wait between printings
|
||||
private static final int PRINT_FREQ_SECONDS = 600;
|
||||
|
||||
// The minimum percentage of memory that must be used before printing.
|
||||
private static final int MEM_PRINT_THRESHOLD_PERCENT = 90;
|
||||
|
||||
// NVidia extension constants.
|
||||
// http://developer.download.nvidia.com/opengl/specs/GL_NVX_gpu_memory_info.txt
|
||||
private static final String NVX_EXT_ID = "GL_NVX_gpu_memory_info";
|
||||
|
||||
private static final int GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX = 0x9047;
|
||||
|
||||
private static final int GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX = 0x9048;
|
||||
|
||||
private static final int GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX = 0x9049;
|
||||
|
||||
private static final int GPU_MEMORY_INFO_EVICTION_COUNT_NVX = 0x904A;
|
||||
|
||||
private static final int GPU_MEMORY_INFO_EVICTED_MEMORY_NVX = 0x904B;
|
||||
|
||||
// ATI extension constants
|
||||
// http://www.opengl.org/registry/specs/ATI/meminfo.txt
|
||||
private static final String ATI_EXT_ID = "GL_ATI_meminfo";
|
||||
|
||||
private static final int VBO_FREE_MEMORY_ATI = 0x87FB;
|
||||
|
||||
private static final int TEXTURE_FREE_MEMORY_ATI = 0x87FC;
|
||||
|
||||
private static final int RENDERBUFFER_FREE_MEMORY_ATI = 0x87FD;
|
||||
|
||||
private static long lastPrintTime;
|
||||
|
||||
private static long lastCheckTime;
|
||||
|
||||
private static int lastNvxEvictionCount = 0;
|
||||
|
||||
public static void printStats(GL gl) {
|
||||
// test both check freq and print freq, the check freq should be fairly
|
||||
// low so as soon as low memory conditions are reached we will
|
||||
// report it so if it is a precursor to a crash it will be in the logs,
|
||||
// the print time will be significantly higher to avoid
|
||||
// spamming the logs if the user is operating normally with high memory
|
||||
// useage.
|
||||
long curTime = System.currentTimeMillis();
|
||||
if (curTime - lastCheckTime < CHECK_FREQ_SECONDS * 1000) {
|
||||
// don't check if it hasn't been very long
|
||||
return;
|
||||
}
|
||||
lastCheckTime = curTime;
|
||||
if (curTime - lastPrintTime < PRINT_FREQ_SECONDS * 1000) {
|
||||
// don't check if we printed to recently
|
||||
return;
|
||||
}
|
||||
boolean lowMem = false;
|
||||
StringBuilder output = new StringBuilder(1024);
|
||||
output.append("-High Graphics Memory usage has been detected.\n");
|
||||
output.append("-Here are some statisitics that might help with that.\n");
|
||||
lowMem |= getSystemStats(output);
|
||||
lowMem |= getImageCacheStats(output);
|
||||
lowMem |= getNvidiaStats(gl, output);
|
||||
// The ATI version is untested, only enable if it has been tested.
|
||||
// lowMem |= getAtiStats(gl, output);
|
||||
|
||||
if (lowMem) {
|
||||
lastPrintTime = curTime;
|
||||
System.out.println(output.toString());
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
protected static boolean getSystemStats(StringBuilder output) {
|
||||
output.append(String.format(" * Current time = %s\n",
|
||||
new Date().toString()));
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
output.append(String.format(" * JVM max memory = %dMB\n",
|
||||
runtime.maxMemory() / 1024 / 1024));
|
||||
output.append(String.format(" * JVM total memory = %dMB\n",
|
||||
runtime.totalMemory() / 1024 / 1024));
|
||||
output.append(String.format(" * JVM free memory = %dMB\n",
|
||||
runtime.freeMemory() / 1024 / 1024));
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static boolean getImageCacheStats(StringBuilder output) {
|
||||
ImageCache memCache = ImageCache.getInstance(CacheType.MEMORY);
|
||||
ImageCache texCache = ImageCache.getInstance(CacheType.TEXTURE);
|
||||
|
||||
long memTotal = memCache.maxSize();
|
||||
long memUsed = memCache.size();
|
||||
long memPercent = memUsed * 100 / memTotal;
|
||||
|
||||
long texTotal = texCache.maxSize();
|
||||
long texUsed = texCache.size();
|
||||
long texPercent = texUsed * 100 / texTotal;
|
||||
|
||||
output.append(String.format(" * Memory Image Cache size = %dMB\n",
|
||||
memTotal / 1024 / 1024));
|
||||
output.append(String.format(" * Memory Image Cache used = %dMB\n",
|
||||
memUsed / 1024 / 1024));
|
||||
output.append(String.format(" * Memory Image Cache percent = %d%%\n",
|
||||
memPercent));
|
||||
output.append(String.format(" * Texture Image Cache size = %dMB\n",
|
||||
texTotal / 1024 / 1024));
|
||||
output.append(String.format(" * Texture Image Cache used = %dMB\n",
|
||||
texUsed / 1024 / 1024));
|
||||
output.append(String.format(" * Texture Image Cache percent = %d%%\n",
|
||||
texPercent));
|
||||
|
||||
return texPercent > MEM_PRINT_THRESHOLD_PERCENT;
|
||||
}
|
||||
|
||||
protected static boolean getNvidiaStats(GL gl, StringBuilder output) {
|
||||
if (gl.isExtensionAvailable(NVX_EXT_ID)) {
|
||||
IntBuffer tmp = IntBuffer.allocate(1);
|
||||
|
||||
tmp.rewind();
|
||||
gl.glGetIntegerv(GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX, tmp);
|
||||
tmp.rewind();
|
||||
int nvxTotalAvailableMem = tmp.get();
|
||||
|
||||
tmp.rewind();
|
||||
gl.glGetIntegerv(GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, tmp);
|
||||
tmp.rewind();
|
||||
int nvxCurrentAvailableMem = tmp.get();
|
||||
|
||||
tmp.rewind();
|
||||
gl.glGetIntegerv(GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, tmp);
|
||||
tmp.rewind();
|
||||
int nvxDedicatedMem = tmp.get();
|
||||
|
||||
tmp.rewind();
|
||||
gl.glGetIntegerv(GPU_MEMORY_INFO_EVICTION_COUNT_NVX, tmp);
|
||||
tmp.rewind();
|
||||
int nvxEvictionCount = tmp.get();
|
||||
|
||||
tmp.rewind();
|
||||
gl.glGetIntegerv(GPU_MEMORY_INFO_EVICTED_MEMORY_NVX, tmp);
|
||||
tmp.rewind();
|
||||
int nvxEvictionMem = tmp.get();
|
||||
|
||||
int nvxPercent = (nvxTotalAvailableMem - nvxCurrentAvailableMem)
|
||||
* 100 / nvxTotalAvailableMem;
|
||||
|
||||
output.append(String.format(
|
||||
" * GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX = %dMB\n",
|
||||
nvxDedicatedMem / 1024));
|
||||
output.append(String.format(
|
||||
" * GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX = %dMB\n",
|
||||
nvxTotalAvailableMem / 1024));
|
||||
output.append(String.format(
|
||||
" * GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX = %dMB\n",
|
||||
nvxCurrentAvailableMem / 1024));
|
||||
output.append(String.format(
|
||||
" * GPU_MEMORY_INFO_EVICTION_COUNT_NVX = %d\n",
|
||||
nvxEvictionCount));
|
||||
output.append(String.format(
|
||||
" * GPU_MEMORY_INFO_EVICTED_MEMORY_NVX = %dMB\n",
|
||||
nvxEvictionMem / 1024));
|
||||
output.append(String.format(" * NVX percent = %d%%\n", nvxPercent));
|
||||
|
||||
int evictions = nvxEvictionCount - lastNvxEvictionCount;
|
||||
lastNvxEvictionCount = nvxEvictionCount;
|
||||
return nvxPercent > MEM_PRINT_THRESHOLD_PERCENT || evictions > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// The ATI version is untested as I don't have an ATI GPU.
|
||||
protected static boolean getAtiStats(GL gl, StringBuilder output) {
|
||||
if (gl.isExtensionAvailable(ATI_EXT_ID)) {
|
||||
IntBuffer tmp = IntBuffer.allocate(4);
|
||||
gl.glGetIntegerv(VBO_FREE_MEMORY_ATI, tmp);
|
||||
tmp.rewind();
|
||||
int vboTotal = tmp.get();
|
||||
int vboLargest = tmp.get();
|
||||
int vboTotalAux = tmp.get();
|
||||
int vboLargestAux = tmp.get();
|
||||
|
||||
tmp.rewind();
|
||||
gl.glGetIntegerv(TEXTURE_FREE_MEMORY_ATI, tmp);
|
||||
tmp.rewind();
|
||||
int texTotal = tmp.get();
|
||||
int texLargest = tmp.get();
|
||||
int texTotalAux = tmp.get();
|
||||
int texLargestAux = tmp.get();
|
||||
|
||||
tmp.rewind();
|
||||
gl.glGetIntegerv(RENDERBUFFER_FREE_MEMORY_ATI, tmp);
|
||||
tmp.rewind();
|
||||
int rbTotal = tmp.get();
|
||||
int rbLargest = tmp.get();
|
||||
int rbTotalAux = tmp.get();
|
||||
int rbLargestAux = tmp.get();
|
||||
|
||||
output.append(String.format(" * VBO_FREE_MEMORY total: %dMB\n",
|
||||
vboTotal / 1024));
|
||||
output.append(String.format(" * VBO_FREE_MEMORY largest: %dMB\n",
|
||||
vboLargest / 1024));
|
||||
output.append(String.format(" * VBO_FREE_MEMORY total aux: %dMB\n",
|
||||
vboTotalAux / 1024));
|
||||
output.append(String.format(
|
||||
" * VBO_FREE_MEMORY largest aux: %dMB\n",
|
||||
vboLargestAux / 1024));
|
||||
output.append(String.format(" * TEXTURE_FREE_MEMORY total: %dMB\n",
|
||||
texTotal / 1024));
|
||||
output.append(String
|
||||
.format(" * TEXTURE_FREE_MEMORY largest: %dMB\n",
|
||||
texLargest / 1024));
|
||||
output.append(String.format(
|
||||
" * TEXTURE_FREE_MEMORY total aux: %dMB\n",
|
||||
texTotalAux / 1024));
|
||||
output.append(String.format(
|
||||
" * TEXTURE_FREE_MEMORY largest aux: %dMB\n",
|
||||
texLargestAux / 1024));
|
||||
output.append(String
|
||||
.format(" * RENDERBUFFER_FREE_MEMORY total: %dMB\n",
|
||||
rbTotal / 1024));
|
||||
output.append(String.format(
|
||||
" * RENDERBUFFER_FREE_MEMORY largest: %dMB\n",
|
||||
rbLargest / 1024));
|
||||
output.append(String.format(
|
||||
" * RENDERBUFFER_FREE_MEMORY total aux: %dMB\n",
|
||||
rbTotalAux / 1024));
|
||||
output.append(String.format(
|
||||
" * RENDERBUFFER_FREE_MEMORY largest aux: %dMB\n",
|
||||
rbLargestAux / 1024));
|
||||
|
||||
// I think this will print output if we have less that 10MB free for
|
||||
// any chunk of memory
|
||||
return vboTotal < 10240 || texTotal < 10240 || rbTotal < 10240;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -173,4 +173,10 @@ public class GLDelegateImage<T extends AbstractGLImage> extends AbstractGLImage
|
|||
image.usaAsFrameBuffer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
super.dispose();
|
||||
image.dispose();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -71,7 +71,8 @@ public class GLImage extends AbstractGLImage implements IImageCacheable {
|
|||
|
||||
protected int size;
|
||||
|
||||
public GLImage(IRenderedImageCallback preparer, Class<? extends IImagingExtension> extensionClass) {
|
||||
public GLImage(IRenderedImageCallback preparer,
|
||||
Class<? extends IImagingExtension> extensionClass) {
|
||||
super(extensionClass);
|
||||
theTexture = null;
|
||||
this.imagePreparer = preparer;
|
||||
|
@ -198,8 +199,7 @@ public class GLImage extends AbstractGLImage implements IImageCacheable {
|
|||
fromRenderedToBuffered(rendImg), false);
|
||||
}
|
||||
|
||||
this.size = rendImg.getHeight() * rendImg.getWidth() * 4
|
||||
* rendImg.getColorModel().getNumColorComponents();
|
||||
this.size = rendImg.getHeight() * rendImg.getWidth() * 4;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,6 +81,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
import com.raytheon.uf.viz.core.preferences.PreferenceConstants;
|
||||
import com.raytheon.viz.core.gl.GLContextBridge;
|
||||
import com.raytheon.viz.core.gl.GLDisposalManager;
|
||||
import com.raytheon.viz.core.gl.GLStats;
|
||||
import com.raytheon.viz.core.gl.IGLFont;
|
||||
import com.raytheon.viz.core.gl.IGLTarget;
|
||||
import com.raytheon.viz.core.gl.glsl.GLSLFactory;
|
||||
|
@ -1079,6 +1080,8 @@ public class GLTarget extends AbstractGraphicsTarget implements IGLTarget {
|
|||
|
||||
GLDisposalManager.performDispose(GLU.getCurrentGL());
|
||||
|
||||
GLStats.printStats(gl);
|
||||
|
||||
GLContextBridge.releaseMasterContext();
|
||||
releaseContext();
|
||||
}
|
||||
|
@ -1378,7 +1381,7 @@ public class GLTarget extends AbstractGraphicsTarget implements IGLTarget {
|
|||
}
|
||||
|
||||
if (needsRelease) {
|
||||
releaseContext();
|
||||
releaseContext();
|
||||
}
|
||||
return bi;
|
||||
}
|
||||
|
@ -2307,96 +2310,6 @@ public class GLTarget extends AbstractGraphicsTarget implements IGLTarget {
|
|||
}
|
||||
}
|
||||
|
||||
protected void printMemoryInformation() {
|
||||
if (gl.isExtensionAvailable("GL_NVX_gpu_memory_info")) {
|
||||
int GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX = 0x9047;
|
||||
int GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX = 0x9048;
|
||||
int GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX = 0x9049;
|
||||
int GPU_MEMORY_INFO_EVICTION_COUNT_NVX = 0x904A;
|
||||
int GPU_MEMORY_INFO_EVICTED_MEMORY_NVX = 0x904B;
|
||||
|
||||
System.out
|
||||
.println("----------------NVIDIA GPU memory info -----------------");
|
||||
IntBuffer tmp = IntBuffer.allocate(1);
|
||||
gl.glGetIntegerv(GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, tmp);
|
||||
tmp.rewind();
|
||||
int totalMem = tmp.get();
|
||||
System.out.println("DEDICATED_VIDMEM: " + totalMem + "KB");
|
||||
tmp.rewind();
|
||||
gl.glGetIntegerv(GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX, tmp);
|
||||
tmp.rewind();
|
||||
int totAvailMem = tmp.get();
|
||||
System.out.println("TOTAL_AVAILABLE_MEMORY: " + totAvailMem + "KB");
|
||||
tmp.rewind();
|
||||
gl.glGetIntegerv(GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, tmp);
|
||||
tmp.rewind();
|
||||
int curAvailMem = tmp.get();
|
||||
System.out.println("CURRENT_AVAILABLE_VIDMEM: " + curAvailMem
|
||||
+ "KB");
|
||||
tmp.rewind();
|
||||
gl.glGetIntegerv(GPU_MEMORY_INFO_EVICTION_COUNT_NVX, tmp);
|
||||
tmp.rewind();
|
||||
int evictCount = tmp.get();
|
||||
System.out.println("INFO_EVICTION_COUNT: " + evictCount);
|
||||
tmp.rewind();
|
||||
gl.glGetIntegerv(GPU_MEMORY_INFO_EVICTED_MEMORY_NVX, tmp);
|
||||
tmp.rewind();
|
||||
int evictMem = tmp.get();
|
||||
System.out.println("INFO_EVICTED_MEMORY: " + evictMem + "KB");
|
||||
} else if (false && gl.isExtensionAvailable("GL_ATI_meminfo")) {
|
||||
// TODO this is untested, I have no ATI gpu
|
||||
int VBO_FREE_MEMORY_ATI = 0x87FB;
|
||||
int TEXTURE_FREE_MEMORY_ATI = 0x87FC;
|
||||
int RENDERBUFFER_FREE_MEMORY_ATI = 0x87FD;
|
||||
|
||||
System.out
|
||||
.println("----------------ATI GPU memory info -----------------");
|
||||
IntBuffer tmp = IntBuffer.allocate(4);
|
||||
gl.glGetIntegerv(VBO_FREE_MEMORY_ATI, tmp);
|
||||
tmp.rewind();
|
||||
int vboTotal = tmp.get();
|
||||
int vboLargest = tmp.get();
|
||||
int vboTotalAux = tmp.get();
|
||||
int vboLargestAux = tmp.get();
|
||||
System.out.println("VBO_FREE_MEMORY total: " + vboTotal + "KB");
|
||||
System.out.println("VBO_FREE_MEMORY largest: " + vboLargest + "KB");
|
||||
System.out.println("VBO_FREE_MEMORY total aux: " + vboTotalAux
|
||||
+ "KB");
|
||||
System.out.println("VBO_FREE_MEMORY largest auc: " + vboLargestAux
|
||||
+ "KB");
|
||||
tmp.rewind();
|
||||
gl.glGetIntegerv(TEXTURE_FREE_MEMORY_ATI, tmp);
|
||||
tmp.rewind();
|
||||
int texTotal = tmp.get();
|
||||
int texLargest = tmp.get();
|
||||
int texTotalAux = tmp.get();
|
||||
int texLargestAux = tmp.get();
|
||||
System.out.println("TEXTURE_FREE_MEMORY total: " + texTotal + "KB");
|
||||
System.out.println("TEXTURE_FREE_MEMORY largest: " + texLargest
|
||||
+ "KB");
|
||||
System.out.println("TEXTURE_FREE_MEMORY total aux: " + texTotalAux
|
||||
+ "KB");
|
||||
System.out.println("TEXTURE_FREE_MEMORY largest auc: "
|
||||
+ texLargestAux + "KB");
|
||||
tmp.rewind();
|
||||
gl.glGetIntegerv(RENDERBUFFER_FREE_MEMORY_ATI, tmp);
|
||||
tmp.rewind();
|
||||
int rbTotal = tmp.get();
|
||||
int rbLargest = tmp.get();
|
||||
int rbTotalAux = tmp.get();
|
||||
int rbLargestAux = tmp.get();
|
||||
System.out.println("RENDERBUFFER_FREE_MEMORY total: " + rbTotal
|
||||
+ "KB");
|
||||
System.out.println("RENDERBUFFER_FREE_MEMORY largest: " + rbLargest
|
||||
+ "KB");
|
||||
System.out.println("RENDERBUFFER_FREE_MEMORY total aux: "
|
||||
+ rbTotalAux + "KB");
|
||||
System.out.println("RENDERBUFFER_FREE_MEMORY largest auc: "
|
||||
+ rbLargestAux + "KB");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <T extends IGraphicsExtensionInterface> T getExtension(
|
||||
Class<T> extensionClass) throws VizException {
|
||||
|
|
|
@ -584,7 +584,9 @@ public abstract class AbstractTileSet implements IRenderable, IMeshCallback {
|
|||
}
|
||||
}
|
||||
if (tileSet != null) {
|
||||
tileSet.dispose();
|
||||
synchronized (tileSet) {
|
||||
tileSet.dispose();
|
||||
}
|
||||
}
|
||||
imageMap.clear();
|
||||
for (CreateTileJob job : jobMap.values()) {
|
||||
|
@ -678,7 +680,9 @@ public abstract class AbstractTileSet implements IRenderable, IMeshCallback {
|
|||
}
|
||||
|
||||
if (tileSet != null) {
|
||||
tileSet.dispose();
|
||||
synchronized (tileSet) {
|
||||
tileSet.dispose();
|
||||
}
|
||||
}
|
||||
tileSet = new ImageTileList();
|
||||
synchronized (tileSet) {
|
||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.viz.gfe.core.internal;
|
|||
|
||||
import java.io.File;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
@ -31,6 +32,7 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Set;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.eclipse.core.runtime.ListenerList;
|
||||
|
||||
|
@ -104,6 +106,13 @@ public abstract class AbstractParmManager implements IParmManager {
|
|||
|
||||
private static final int NOTIFICATION_THREADS = 4;
|
||||
|
||||
private static final SimpleDateFormat dateFormat = new SimpleDateFormat(
|
||||
DatabaseID.MODEL_TIME_FORMAT);
|
||||
|
||||
static {
|
||||
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
}
|
||||
|
||||
protected class ParmIDVis {
|
||||
private ParmID pid;
|
||||
|
||||
|
@ -469,8 +478,8 @@ public abstract class AbstractParmManager implements IParmManager {
|
|||
if (string.length() - pos == 14) {
|
||||
try {
|
||||
dtg = string.substring(pos + 1);
|
||||
synchronized (DatabaseID.dateFormat) {
|
||||
DatabaseID.dateFormat.parse(dtg);
|
||||
synchronized (dateFormat) {
|
||||
dateFormat.parse(dtg);
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
return null;
|
||||
|
|
|
@ -364,6 +364,10 @@ public class GFEColorbarResource extends
|
|||
if (container != null) {
|
||||
container.registerMouseHandler(handler, InputPriority.PERSPECTIVE);
|
||||
}
|
||||
|
||||
if (currentParm != null) {
|
||||
currentParm.getListeners().addPickupValueChangedListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -22,6 +22,7 @@ package com.raytheon.viz.grid.rsc;
|
|||
import java.io.FileNotFoundException;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
@ -129,7 +130,7 @@ public abstract class AbstractMapVectorResource extends
|
|||
|
||||
protected boolean retrievedAllData = false;
|
||||
|
||||
private Map<DataTime, PluginDataObject> dataObjectMap;
|
||||
protected Map<DataTime, PluginDataObject> dataObjectMap;
|
||||
|
||||
protected String uuid;
|
||||
|
||||
|
@ -330,7 +331,7 @@ public abstract class AbstractMapVectorResource extends
|
|||
this.vcrManagerJob = new VectorContourRenderableManagerJob();
|
||||
this.gdManagerJob = new GriddedDisplayManagerJob();
|
||||
|
||||
setDataObjectMap(new HashMap<DataTime, PluginDataObject>());
|
||||
dataObjectMap = new HashMap<DataTime, PluginDataObject>();
|
||||
uuid = UUID.randomUUID().toString();
|
||||
resourceData.addChangeListener(new IResourceDataChanged() {
|
||||
@Override
|
||||
|
@ -841,8 +842,9 @@ public abstract class AbstractMapVectorResource extends
|
|||
this.gdManagerJob.shutdown();
|
||||
this.gdManagerJob.disposeInternal();
|
||||
}
|
||||
|
||||
getDataObjectMap().clear();
|
||||
synchronized (dataObjectMap) {
|
||||
dataObjectMap.clear();
|
||||
}
|
||||
retrievedAllData = false;
|
||||
}
|
||||
|
||||
|
@ -984,7 +986,9 @@ public abstract class AbstractMapVectorResource extends
|
|||
*/
|
||||
@Override
|
||||
public void remove(DataTime dataTime) {
|
||||
this.getDataObjectMap().remove(dataTime);
|
||||
synchronized (dataObjectMap) {
|
||||
dataObjectMap.remove(dataTime);
|
||||
}
|
||||
this.vcrManagerJob.removeDataTime(dataTime);
|
||||
this.gdManagerJob.removeDataTime(dataTime);
|
||||
recreateDataTimes();
|
||||
|
@ -994,8 +998,8 @@ public abstract class AbstractMapVectorResource extends
|
|||
* Recreate all the datatimes from the objects
|
||||
*/
|
||||
protected void recreateDataTimes() {
|
||||
this.dataTimes = new ArrayList<DataTime>(getDataObjectMap().size());
|
||||
dataTimes.addAll(this.getDataObjectMap().keySet());
|
||||
this.dataTimes = new ArrayList<DataTime>(this.getDataObjectMap()
|
||||
.keySet());
|
||||
}
|
||||
|
||||
public void addRecord(PluginDataObject record) throws VizException {
|
||||
|
@ -1008,7 +1012,9 @@ public abstract class AbstractMapVectorResource extends
|
|||
+ record.getClass().getName());
|
||||
}
|
||||
DataTime dt = record.getDataTime();
|
||||
getDataObjectMap().put(dt, record);
|
||||
synchronized (dataObjectMap) {
|
||||
dataObjectMap.put(dt, record);
|
||||
}
|
||||
|
||||
if (this.retrievedAllData) {
|
||||
this.addJobRequest(dt);
|
||||
|
@ -1062,17 +1068,20 @@ public abstract class AbstractMapVectorResource extends
|
|||
this.styleRule = styleRule;
|
||||
}
|
||||
|
||||
public synchronized Map<DataTime, PluginDataObject> getDataObjectMap() {
|
||||
return dataObjectMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dataObjectMap
|
||||
* the dataObjectMap to set
|
||||
* Get a copy of dataObjectMap, this copy is safe to use without
|
||||
* synchronizing, if you need to modify the dataObjectMap, use the field
|
||||
* directly and synchronize on it.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected synchronized void setDataObjectMap(
|
||||
Map<DataTime, PluginDataObject> dataObjectMap) {
|
||||
this.dataObjectMap = dataObjectMap;
|
||||
protected Map<DataTime, PluginDataObject> getDataObjectMap() {
|
||||
if (dataObjectMap == null) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
synchronized (dataObjectMap) {
|
||||
return new HashMap<DataTime, PluginDataObject>(dataObjectMap);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized DataTime getDisplayedDataTime() {
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.text.DecimalFormat;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
@ -199,6 +198,14 @@ public class GridResource extends
|
|||
|
||||
private StyleRule styleRule;
|
||||
|
||||
/**
|
||||
* The great protector of all things related to dataTimes, do not modify or
|
||||
* iterate over pdosToParse, dataTimes, or tileSet unless you sync on this
|
||||
* or else...
|
||||
*
|
||||
*/
|
||||
protected Object timeLock = new Object();
|
||||
|
||||
/**
|
||||
* Extends the MemoryBasedTileSet class so that we can have direct access to
|
||||
* the loadedData
|
||||
|
@ -585,12 +592,14 @@ public class GridResource extends
|
|||
|
||||
GribRecord[] records = resourceData.getRecords();
|
||||
GribRecord emptyRecord = new GribRecord();
|
||||
for (int i = 0; i < records.length; i++) {
|
||||
if (emptyRecord.equals(records[i])) {
|
||||
// Don't add empty records
|
||||
continue;
|
||||
synchronized (timeLock) {
|
||||
for (int i = 0; i < records.length; i++) {
|
||||
if (emptyRecord.equals(records[i])) {
|
||||
// Don't add empty records
|
||||
continue;
|
||||
}
|
||||
pdosToParse.add(records[i]);
|
||||
}
|
||||
pdosToParse.add(records[i]);
|
||||
}
|
||||
|
||||
if (resourceData.getNameGenerator() == null) {
|
||||
|
@ -660,14 +669,16 @@ public class GridResource extends
|
|||
|
||||
mbts = createTileSet(record, lvlSet, levelConverter);
|
||||
mbts.setMapDescriptor(descriptor);
|
||||
Set<DataTime> dateSet = tileSet.keySet();
|
||||
dataTimes.clear();
|
||||
Iterator<DataTime> dateIterator = dateSet.iterator();
|
||||
while (dateIterator.hasNext()) {
|
||||
dataTimes.add(dateIterator.next());
|
||||
}
|
||||
synchronized (timeLock) {
|
||||
Set<DataTime> dateSet = tileSet.keySet();
|
||||
dataTimes.clear();
|
||||
Iterator<DataTime> dateIterator = dateSet.iterator();
|
||||
while (dateIterator.hasNext()) {
|
||||
dataTimes.add(dateIterator.next());
|
||||
}
|
||||
|
||||
Collections.sort(dataTimes);
|
||||
Collections.sort(dataTimes);
|
||||
}
|
||||
|
||||
levels = new SingleLevel[lvlSet.size()];
|
||||
Iterator<SingleLevel> lvlIterator = lvlSet.iterator();
|
||||
|
@ -685,12 +696,14 @@ public class GridResource extends
|
|||
Set<SingleLevel> lvlSet, UnitConverter levelConverter)
|
||||
throws VizException {
|
||||
DataTime dataTime = record.getDataTime();
|
||||
Map<Float, GridMemoryBasedTileSet> tilemap = tileSet.get(dataTime);
|
||||
if (tilemap == null) {
|
||||
tilemap = new HashMap<Float, GridMemoryBasedTileSet>();
|
||||
tileSet.put(dataTime, tilemap);
|
||||
Map<Float, GridMemoryBasedTileSet> tilemap = null;
|
||||
synchronized (timeLock) {
|
||||
tilemap = tileSet.get(dataTime);
|
||||
if (tilemap == null) {
|
||||
tilemap = new HashMap<Float, GridMemoryBasedTileSet>();
|
||||
tileSet.put(dataTime, tilemap);
|
||||
}
|
||||
}
|
||||
|
||||
float convertedLevel = (float) levelConverter.convert(record
|
||||
.getModelInfo().getLevelOneValue());
|
||||
|
||||
|
@ -776,116 +789,109 @@ public class GridResource extends
|
|||
*/
|
||||
@Override
|
||||
protected void disposeInternal() {
|
||||
|
||||
for (Map.Entry<DataTime, Map<Float, GridMemoryBasedTileSet>> set : tileSet
|
||||
.entrySet()) {
|
||||
for (Map.Entry<Float, GridMemoryBasedTileSet> tile : set.getValue()
|
||||
synchronized (timeLock) {
|
||||
for (Map.Entry<DataTime, Map<Float, GridMemoryBasedTileSet>> set : tileSet
|
||||
.entrySet()) {
|
||||
tile.getValue().dispose();
|
||||
for (Map.Entry<Float, GridMemoryBasedTileSet> tile : set
|
||||
.getValue().entrySet()) {
|
||||
tile.getValue().dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initInternal(IGraphicsTarget target) throws VizException {
|
||||
this.target = target;
|
||||
synchronized (timeLock) {
|
||||
this.target = target;
|
||||
|
||||
synchronized (pdosToParse) {
|
||||
if (pdosToParse.size() > 0) {
|
||||
for (PluginDataObject pdo : pdosToParse) {
|
||||
createTile(pdo);
|
||||
}
|
||||
pdosToParse.clear();
|
||||
}
|
||||
}
|
||||
|
||||
boolean combineResources = combineOperation != CombineOperation.NONE;
|
||||
boolean combineResources = combineOperation != CombineOperation.NONE;
|
||||
|
||||
viewType = target.getViewType();
|
||||
Map<DataTime, Map<Float, GridMemoryBasedTileSet>> combinedSet = new HashMap<DataTime, Map<Float, GridMemoryBasedTileSet>>();
|
||||
for (Map.Entry<Integer, GridMemoryBasedTileSet> baseTileEntry : baseTiles
|
||||
.entrySet()) {
|
||||
GridMemoryBasedTileSet baseTile = baseTileEntry.getValue();
|
||||
baseTile.setMapDescriptor(descriptor);
|
||||
baseTile.init(target);
|
||||
if (combineResources && !baseTile.isCombined()) {
|
||||
Entry<Float, GridMemoryBasedTileSet> tileSetRef = null;
|
||||
// Need to find the reference in order to update the object when
|
||||
// it comes back as a new combined object
|
||||
for (Map.Entry<DataTime, Map<Float, GridMemoryBasedTileSet>> set : tileSet
|
||||
.entrySet()) {
|
||||
for (Map.Entry<Float, GridMemoryBasedTileSet> tile : set
|
||||
.getValue().entrySet()) {
|
||||
if (tile.getValue().getDataTime()
|
||||
.equals(baseTile.getDataTime())) {
|
||||
tileSetRef = tile;
|
||||
viewType = target.getViewType();
|
||||
Map<DataTime, Map<Float, GridMemoryBasedTileSet>> combinedSet = new HashMap<DataTime, Map<Float, GridMemoryBasedTileSet>>();
|
||||
for (Map.Entry<Integer, GridMemoryBasedTileSet> baseTileEntry : baseTiles
|
||||
.entrySet()) {
|
||||
GridMemoryBasedTileSet baseTile = baseTileEntry.getValue();
|
||||
baseTile.setMapDescriptor(descriptor);
|
||||
baseTile.init(target);
|
||||
if (combineResources && !baseTile.isCombined()) {
|
||||
Entry<Float, GridMemoryBasedTileSet> tileSetRef = null;
|
||||
// Need to find the reference in order to update the object
|
||||
// when
|
||||
// it comes back as a new combined object
|
||||
for (Map.Entry<DataTime, Map<Float, GridMemoryBasedTileSet>> set : tileSet
|
||||
.entrySet()) {
|
||||
for (Map.Entry<Float, GridMemoryBasedTileSet> tile : set
|
||||
.getValue().entrySet()) {
|
||||
if (tile.getValue().getDataTime()
|
||||
.equals(baseTile.getDataTime())) {
|
||||
tileSetRef = tile;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tileSetRef != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GridMemoryBasedTileSet combinedResourceData = combineResourceData(baseTile);
|
||||
if (tileSetRef != null) {
|
||||
break;
|
||||
tileSetRef.setValue(combinedResourceData);
|
||||
}
|
||||
}
|
||||
|
||||
GridMemoryBasedTileSet combinedResourceData = combineResourceData(baseTile);
|
||||
if (tileSetRef != null) {
|
||||
tileSetRef.setValue(combinedResourceData);
|
||||
baseTileEntry.setValue(combinedResourceData);
|
||||
}
|
||||
|
||||
baseTileEntry.setValue(combinedResourceData);
|
||||
}
|
||||
}
|
||||
DataTime[] primaryDataTimes = descriptor.getTimeMatchingMap().get(this);
|
||||
for (int i = 0; i < primaryDataTimes.length; i++) {
|
||||
Map<Float, GridMemoryBasedTileSet> map = tileSet
|
||||
.get(primaryDataTimes[i]);
|
||||
if (map != null) {
|
||||
for (Map.Entry<Float, GridMemoryBasedTileSet> tile : map
|
||||
.entrySet()) {
|
||||
if (baseTiles.values().contains(tile.getValue())) {
|
||||
if (combineResources) {
|
||||
DataTime[] primaryDataTimes = descriptor.getTimeMatchingMap().get(
|
||||
this);
|
||||
for (int i = 0; i < primaryDataTimes.length; i++) {
|
||||
Map<Float, GridMemoryBasedTileSet> map = tileSet
|
||||
.get(primaryDataTimes[i]);
|
||||
if (map != null) {
|
||||
for (Map.Entry<Float, GridMemoryBasedTileSet> tile : map
|
||||
.entrySet()) {
|
||||
if (baseTiles.values().contains(tile.getValue())) {
|
||||
if (combineResources) {
|
||||
Map<Float, GridMemoryBasedTileSet> map2 = new HashMap<Float, GridResource.GridMemoryBasedTileSet>();
|
||||
map2.put(tile.getKey(), tile.getValue());
|
||||
combinedSet.put(primaryDataTimes[i], map2);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
tile.getValue().init(target);
|
||||
|
||||
if (!tile.getValue().isCombined()) {
|
||||
GridMemoryBasedTileSet combinedResourceData = combineResourceData(tile
|
||||
.getValue());
|
||||
Map<Float, GridMemoryBasedTileSet> map2 = new HashMap<Float, GridResource.GridMemoryBasedTileSet>();
|
||||
map2.put(tile.getKey(), tile.getValue());
|
||||
map2.put(tile.getKey(), combinedResourceData);
|
||||
combinedSet.put(primaryDataTimes[i], map2);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
tile.getValue().init(target);
|
||||
|
||||
if (!tile.getValue().isCombined()) {
|
||||
GridMemoryBasedTileSet combinedResourceData = combineResourceData(tile
|
||||
.getValue());
|
||||
Map<Float, GridMemoryBasedTileSet> map2 = new HashMap<Float, GridResource.GridMemoryBasedTileSet>();
|
||||
map2.put(tile.getKey(), combinedResourceData);
|
||||
combinedSet.put(primaryDataTimes[i], map2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!combinedSet.isEmpty()) {
|
||||
tileSet = combinedSet;
|
||||
List<DataTime> newDataTimes = new ArrayList<DataTime>();
|
||||
if (!combinedSet.isEmpty()) {
|
||||
tileSet = combinedSet;
|
||||
List<DataTime> newDataTimes = new ArrayList<DataTime>();
|
||||
|
||||
for (Entry<DataTime, Map<Float, GridMemoryBasedTileSet>> entry : combinedSet
|
||||
.entrySet()) {
|
||||
newDataTimes.add(entry.getKey());
|
||||
for (Entry<DataTime, Map<Float, GridMemoryBasedTileSet>> entry : combinedSet
|
||||
.entrySet()) {
|
||||
newDataTimes.add(entry.getKey());
|
||||
}
|
||||
Collections.sort(newDataTimes);
|
||||
dataTimes = newDataTimes;
|
||||
}
|
||||
Collections.sort(newDataTimes, dataTime);
|
||||
dataTimes = newDataTimes;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DataTime Comparator
|
||||
*/
|
||||
private static Comparator<DataTime> dataTime = new Comparator<DataTime>() {
|
||||
@Override
|
||||
public int compare(DataTime arg0, DataTime arg1) {
|
||||
return arg0.compareTo(arg1);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Combine the given tiles sets
|
||||
*
|
||||
|
@ -1227,11 +1233,13 @@ public class GridResource extends
|
|||
@Override
|
||||
public void setDescriptor(MapDescriptor descriptor) {
|
||||
this.descriptor = descriptor;
|
||||
for (Map.Entry<DataTime, Map<Float, GridMemoryBasedTileSet>> set : tileSet
|
||||
.entrySet()) {
|
||||
for (Map.Entry<Float, GridMemoryBasedTileSet> tile : set.getValue()
|
||||
synchronized (timeLock) {
|
||||
for (Map.Entry<DataTime, Map<Float, GridMemoryBasedTileSet>> set : tileSet
|
||||
.entrySet()) {
|
||||
tile.getValue().setMapDescriptor(this.descriptor);
|
||||
for (Map.Entry<Float, GridMemoryBasedTileSet> tile : set
|
||||
.getValue().entrySet()) {
|
||||
tile.getValue().setMapDescriptor(this.descriptor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1248,22 +1256,24 @@ public class GridResource extends
|
|||
}
|
||||
}
|
||||
if (reproject) {
|
||||
// If we are reprojecting to screen space, clear all tiles
|
||||
for (Map.Entry<DataTime, Map<Float, GridMemoryBasedTileSet>> set : tileSet
|
||||
.entrySet()) {
|
||||
for (Map.Entry<Float, GridMemoryBasedTileSet> tile : set
|
||||
.getValue().entrySet()) {
|
||||
tile.getValue().dispose();
|
||||
pdosToParse.add(tile.getValue().getPluginDataObject());
|
||||
synchronized (timeLock) {
|
||||
// If we are reprojecting to screen space, clear all tiles
|
||||
for (Map.Entry<DataTime, Map<Float, GridMemoryBasedTileSet>> set : tileSet
|
||||
.entrySet()) {
|
||||
for (Map.Entry<Float, GridMemoryBasedTileSet> tile : set
|
||||
.getValue().entrySet()) {
|
||||
tile.getValue().dispose();
|
||||
pdosToParse.add(tile.getValue().getPluginDataObject());
|
||||
}
|
||||
}
|
||||
}
|
||||
tileSet.clear();
|
||||
baseTiles.clear();
|
||||
if (pdosToParse.size() > 0) {
|
||||
for (PluginDataObject pdo : pdosToParse) {
|
||||
createTile(pdo);
|
||||
tileSet.clear();
|
||||
baseTiles.clear();
|
||||
if (pdosToParse.size() > 0) {
|
||||
for (PluginDataObject pdo : pdosToParse) {
|
||||
createTile(pdo);
|
||||
}
|
||||
pdosToParse.clear();
|
||||
}
|
||||
pdosToParse.clear();
|
||||
}
|
||||
} else {
|
||||
for (GridMemoryBasedTileSet tile : baseTiles.values()) {
|
||||
|
@ -1463,41 +1473,44 @@ public class GridResource extends
|
|||
|
||||
@Override
|
||||
public void remove(DataTime dataTime) {
|
||||
Map<Float, GridMemoryBasedTileSet> ts = tileSet.remove(dataTime);
|
||||
if (ts == null) {
|
||||
return;
|
||||
}
|
||||
synchronized (timeLock) {
|
||||
Map<Float, GridMemoryBasedTileSet> ts = tileSet.remove(dataTime);
|
||||
if (ts == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (Map.Entry<Float, GridMemoryBasedTileSet> tile : ts.entrySet()) {
|
||||
tile.getValue().dispose();
|
||||
}
|
||||
Set<DataTime> dateSet = tileSet.keySet();
|
||||
dataTimes.clear();
|
||||
Iterator<DataTime> dateIterator = dateSet.iterator();
|
||||
while (dateIterator.hasNext()) {
|
||||
dataTimes.add(dateIterator.next());
|
||||
}
|
||||
|
||||
Collections.sort(dataTimes);
|
||||
for (Map.Entry<Float, GridMemoryBasedTileSet> tile : ts.entrySet()) {
|
||||
tile.getValue().dispose();
|
||||
}
|
||||
Set<DataTime> dateSet = tileSet.keySet();
|
||||
dataTimes.clear();
|
||||
Iterator<DataTime> dateIterator = dateSet.iterator();
|
||||
while (dateIterator.hasNext()) {
|
||||
dataTimes.add(dateIterator.next());
|
||||
}
|
||||
|
||||
Collections.sort(dataTimes);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resourceChanged(ChangeType type, Object object) {
|
||||
if (type.equals(ChangeType.DATA_UPDATE)) {
|
||||
PluginDataObject[] pdos = (PluginDataObject[]) object;
|
||||
synchronized (timeLock) {
|
||||
for (PluginDataObject pdo : pdos) {
|
||||
|
||||
for (PluginDataObject pdo : pdos) {
|
||||
|
||||
if (pdo != null) {
|
||||
if (CombineOperation.DIFFERENCE.equals(combineOperation)
|
||||
&& !(pdo instanceof CombinedGribRecord)) {
|
||||
// Do nothing, timematcher will take care of it.
|
||||
} else {
|
||||
if (target != null) {
|
||||
createTile(pdo);
|
||||
if (pdo != null) {
|
||||
if (CombineOperation.DIFFERENCE
|
||||
.equals(combineOperation)
|
||||
&& !(pdo instanceof CombinedGribRecord)) {
|
||||
// Do nothing, timematcher will take care of it.
|
||||
} else {
|
||||
pdosToParse.add(pdo);
|
||||
if (target != null) {
|
||||
createTile(pdo);
|
||||
} else {
|
||||
pdosToParse.add(pdo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,6 @@ 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.SimulatedTime;
|
||||
import com.raytheon.uf.viz.core.RecordFactory;
|
||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
||||
import com.raytheon.uf.viz.core.catalog.ScriptCreator;
|
||||
|
@ -370,10 +369,7 @@ public class PointDataCubeAdapter implements IDataCubeAdapter {
|
|||
throws VizException {
|
||||
TimeQueryRequestSet set = new TimeQueryRequestSet();
|
||||
set.setRequests(requests.toArray(new TimeQueryRequest[0]));
|
||||
// boundary for time queries
|
||||
for (TimeQueryRequest req: set.getRequests()) {
|
||||
req.setSimDate(SimulatedTime.getSystemTime().getTime());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<List<DataTime>> result = (List<List<DataTime>>) ThriftClient
|
||||
.sendRequest(set);
|
||||
|
|
|
@ -121,24 +121,25 @@ public class RadarDataCubeAdapter extends PointDataCubeAdapter {
|
|||
DbQueryResponse response, boolean latestOnly, BinOffset binOffset) {
|
||||
String dataTimefield = DATA_TIME_FIELD;
|
||||
if (latestOnly) {
|
||||
dataTimefield = LATEST_DATA_TIME_FIELD;
|
||||
}
|
||||
Collection<DataTime> results = new HashSet<DataTime>();
|
||||
int i = 0;
|
||||
for (Map<String, Object> map : response.getResults()) {
|
||||
DataTime time = null;
|
||||
if (latestOnly) {
|
||||
time = new DataTime((Date) map.get(dataTimefield), 0);
|
||||
} else {
|
||||
time = (DataTime) map.get(dataTimefield);
|
||||
time.setLevelValue((Double) map.get(LEVEL_FIELD));
|
||||
}
|
||||
// Best res requests need this because they span a time period
|
||||
if (time.getRefTime().before(SimulatedTime.getSystemTime().getTime())) {
|
||||
results.add(time);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
dataTimefield = LATEST_DATA_TIME_FIELD;
|
||||
}
|
||||
Collection<DataTime> results = new HashSet<DataTime>();
|
||||
int i = 0;
|
||||
for (Map<String, Object> map : response.getResults()) {
|
||||
DataTime time = null;
|
||||
if (latestOnly) {
|
||||
time = new DataTime((Date) map.get(dataTimefield), 0);
|
||||
} else {
|
||||
time = (DataTime) map.get(dataTimefield);
|
||||
time.setLevelValue((Double) map.get(LEVEL_FIELD));
|
||||
}
|
||||
// Best res requests need this because they span a time period
|
||||
if (time.getRefTime().before(
|
||||
SimulatedTime.getSystemTime().getTime())) {
|
||||
results.add(time);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
if (binOffset != null) {
|
||||
Set<DataTime> scaledDates = new TreeSet<DataTime>();
|
||||
|
@ -173,7 +174,6 @@ public class RadarDataCubeAdapter extends PointDataCubeAdapter {
|
|||
List<DbQueryRequest> dbRequests = new ArrayList<DbQueryRequest>(
|
||||
requests.size());
|
||||
for (TimeQueryRequest request : requests) {
|
||||
request.setSimDate(SimulatedTime.getSystemTime().getTime());
|
||||
dbRequests.add(getTimeQueryRequest(request.getQueryTerms(),
|
||||
request.isMaxQuery()));
|
||||
}
|
||||
|
@ -188,9 +188,7 @@ public class RadarDataCubeAdapter extends PointDataCubeAdapter {
|
|||
TimeQueryRequest request = requests.get(i);
|
||||
Collection<DataTime> times = processTimeQueryResponse(response,
|
||||
request.isMaxQuery(), request.getBinOffset());
|
||||
|
||||
|
||||
|
||||
|
||||
result.add(new ArrayList<DataTime>(times));
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -58,7 +58,6 @@ import com.raytheon.uf.common.geospatial.MapUtil;
|
|||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
||||
import com.raytheon.uf.common.time.BinOffset;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
import com.raytheon.uf.viz.core.HDF5Util;
|
||||
import com.raytheon.uf.viz.core.catalog.CatalogQuery;
|
||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
||||
|
@ -465,7 +464,6 @@ public class SatelliteDataCubeAdapter implements IDataCubeAdapter {
|
|||
List<TimeQueryRequest> baseRequests = new ArrayList<TimeQueryRequest>(
|
||||
requests.size());
|
||||
for (TimeQueryRequest request : requests) {
|
||||
request.setSimDate(SimulatedTime.getSystemTime().getTime());
|
||||
if (!request.getQueryTerms().containsKey("DERIVED")) {
|
||||
baseRequests.add(request);
|
||||
} else {
|
||||
|
@ -543,7 +541,6 @@ public class SatelliteDataCubeAdapter implements IDataCubeAdapter {
|
|||
DerivParamField field = (DerivParamField) ifield;
|
||||
TimeQueryRequest newRequest = new TimeQueryRequest();
|
||||
newRequest.setBinOffset(binOffset);
|
||||
newRequest.setSimDate(SimulatedTime.getSystemTime().getTime());
|
||||
newRequest.setMaxQuery(false);
|
||||
newRequest.setQueryTerms(modifyQuery(queryParams, field));
|
||||
newRequest.setPluginName("satellite");
|
||||
|
|
|
@ -917,11 +917,8 @@ public class GFEDao extends DefaultPluginDao {
|
|||
|
||||
for (int i = 0; i < result.getResultCount(); i++) {
|
||||
DatabaseID dbId = null;
|
||||
synchronized (DatabaseID.dateFormat) {
|
||||
dbId = new DatabaseID(siteID, DataType.GRID, "D2D", gfeModel,
|
||||
DatabaseID.dateFormat.format(result.getRowColumnValue(
|
||||
i, 0)));
|
||||
}
|
||||
dbId = new DatabaseID(siteID, DataType.GRID, "D2D", gfeModel,
|
||||
(Date) result.getRowColumnValue(i, 0));
|
||||
if (!dbInventory.contains(dbId)) {
|
||||
dbInventory.add(dbId);
|
||||
}
|
||||
|
|
|
@ -113,8 +113,7 @@ public class GfeIngestNotificationFilter {
|
|||
// ignore if no mapping
|
||||
if (gfeModel != null && gfeModel.length() > 0) {
|
||||
DatabaseID dbId = new DatabaseID(site, DataType.GRID,
|
||||
"D2D", gfeModel, DatabaseID.dateFormat.format(grib
|
||||
.getDataTime().getRefTime()));
|
||||
"D2D", gfeModel, grib.getDataTime().getRefTime());
|
||||
|
||||
if ((!D2DParmIdCache.getInstance().getDatabaseIDs()
|
||||
.contains(dbId))
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
**/
|
||||
package com.raytheon.edex.plugin.gfe.smartinit;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
@ -55,9 +54,6 @@ public class InitModules {
|
|||
|
||||
private static final Log logger = LogFactory.getLog(InitModules.class);
|
||||
|
||||
public static final SimpleDateFormat dateFormat = (SimpleDateFormat) DatabaseID.dateFormat
|
||||
.clone();
|
||||
|
||||
// Counter used to simply force one full model run to complete a smart init
|
||||
// before another when many inits started at once
|
||||
private static long manualOffset = 0;
|
||||
|
|
|
@ -20,7 +20,9 @@
|
|||
package com.raytheon.edex.plugin.gfe.smartinit;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embeddable;
|
||||
|
@ -28,6 +30,7 @@ import javax.persistence.EnumType;
|
|||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
@ -56,6 +59,13 @@ public class SmartInitRecordPK implements ISerializableObject, Serializable,
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final SimpleDateFormat dateFormat = new SimpleDateFormat(
|
||||
DatabaseID.MODEL_TIME_FORMAT);
|
||||
|
||||
static {
|
||||
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
}
|
||||
|
||||
public enum State {
|
||||
PENDING, RUNNING
|
||||
};
|
||||
|
@ -139,28 +149,37 @@ public class SmartInitRecordPK implements ISerializableObject, Serializable,
|
|||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
if (this == obj) {
|
||||
return true;
|
||||
if (obj == null)
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
SmartInitRecordPK other = (SmartInitRecordPK) obj;
|
||||
if (initName == null) {
|
||||
if (other.initName != null)
|
||||
if (other.initName != null) {
|
||||
return false;
|
||||
} else if (!initName.equals(other.initName))
|
||||
}
|
||||
} else if (!initName.equals(other.initName)) {
|
||||
return false;
|
||||
}
|
||||
if (state == null) {
|
||||
if (other.state != null)
|
||||
if (other.state != null) {
|
||||
return false;
|
||||
} else if (!state.equals(other.state))
|
||||
}
|
||||
} else if (!state.equals(other.state)) {
|
||||
return false;
|
||||
}
|
||||
if (validTime == null) {
|
||||
if (other.validTime != null)
|
||||
if (other.validTime != null) {
|
||||
return false;
|
||||
} else if (!validTime.equals(other.validTime))
|
||||
}
|
||||
} else if (!validTime.equals(other.validTime)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -170,8 +189,8 @@ public class SmartInitRecordPK implements ISerializableObject, Serializable,
|
|||
tmp.append(initName);
|
||||
tmp.append(" ValidTime: ");
|
||||
if (validTime != null) {
|
||||
synchronized (InitModules.dateFormat) {
|
||||
tmp.append(InitModules.dateFormat.format(validTime));
|
||||
synchronized (dateFormat) {
|
||||
tmp.append(dateFormat.format(validTime));
|
||||
}
|
||||
} else {
|
||||
tmp.append("null");
|
||||
|
|
|
@ -36,12 +36,10 @@ from java.util import ArrayList
|
|||
from com.raytheon.edex.plugin.gfe.config import IFPServerConfig
|
||||
from com.raytheon.edex.plugin.gfe.config import IFPServerConfigManager
|
||||
from com.raytheon.edex.plugin.gfe.util import CartDomain2D
|
||||
from com.raytheon.uf.common.dataplugin.gfe.db.objects import DatabaseID
|
||||
from com.raytheon.uf.common.dataplugin.gfe.db.objects import GridLocation
|
||||
from com.raytheon.uf.common.dataplugin.gfe.reference import ReferenceData
|
||||
from com.raytheon.uf.common.dataplugin.gfe.reference import ReferenceID
|
||||
from com.raytheon.uf.common.dataplugin.gfe.reference import ReferenceData_CoordinateType as CoordinateType
|
||||
from com.raytheon.uf.common.dataplugin.gfe.util import GfeUtil
|
||||
|
||||
from com.vividsolutions.jts.geom import Coordinate
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class DatabaseID implements Serializable, Comparable<DatabaseID>,
|
|||
|
||||
public static final String MODEL_TIME_FORMAT = "yyyyMMdd_HHmm";
|
||||
|
||||
public static final SimpleDateFormat dateFormat = new SimpleDateFormat(
|
||||
private static final SimpleDateFormat dateFormat = new SimpleDateFormat(
|
||||
MODEL_TIME_FORMAT);
|
||||
|
||||
static {
|
||||
|
@ -150,7 +150,14 @@ public class DatabaseID implements Serializable, Comparable<DatabaseID>,
|
|||
*/
|
||||
public DatabaseID(String siteId, DataType format, String dbType,
|
||||
String modelName, Date modelTime) {
|
||||
this(siteId, format, dbType, modelName, dateFormat.format(modelTime));
|
||||
this.siteId = siteId;
|
||||
this.format = format;
|
||||
this.dbType = dbType;
|
||||
this.modelName = modelName;
|
||||
synchronized (dateFormat) {
|
||||
this.modelTime = dateFormat.format(modelTime);
|
||||
}
|
||||
encodeIdentifier();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -345,10 +352,15 @@ public class DatabaseID implements Serializable, Comparable<DatabaseID>,
|
|||
}
|
||||
|
||||
private boolean decodeDtg(String dtgString) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmm");
|
||||
if (dtgString == null
|
||||
|| dtgString.length() != MODEL_TIME_FORMAT.length()) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
Date date = sdf.parse(dtgString);
|
||||
modelTime = sdf.format(date);
|
||||
synchronized (dateFormat) {
|
||||
dateFormat.parse(dtgString);
|
||||
}
|
||||
modelTime = dtgString;
|
||||
} catch (ParseException e) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -209,21 +209,6 @@ public class GfeUtil {
|
|||
return new File(hdf5DirPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a calendar to a model time used by DatabaseID
|
||||
*
|
||||
* @param refTime
|
||||
* The model time as a calendar
|
||||
* @return The string representation of the model time for use with
|
||||
* DatabaseID
|
||||
*/
|
||||
public static String modelTimeToString(Calendar refTime) {
|
||||
Date time = refTime.getTime();
|
||||
synchronized (DatabaseID.dateFormat) {
|
||||
return DatabaseID.dateFormat.format(time);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts a specified data into GMT
|
||||
*
|
||||
|
|
|
@ -26,6 +26,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
|||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
||||
import com.raytheon.uf.common.time.BinOffset;
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
|
||||
/**
|
||||
* Request to query available times. A bin offset can be included and will be
|
||||
|
@ -48,6 +49,10 @@ import com.raytheon.uf.common.time.BinOffset;
|
|||
@DynamicSerialize
|
||||
public class TimeQueryRequest implements IServerRequest {
|
||||
|
||||
public TimeQueryRequest() {
|
||||
this.simDate = SimulatedTime.getSystemTime().getTime();
|
||||
}
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String pluginName;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ fi
|
|||
|
||||
# Execute the CAVE PDE Build.
|
||||
# The Sun JDK Build.
|
||||
time ./build.sh -eclipse=/opt/uframe-eclipse
|
||||
time /bin/bash build.sh -eclipse=/opt/uframe-eclipse
|
||||
RC=$?
|
||||
|
||||
if [ ${RC} -ne 0 ]; then
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#
|
||||
Name: awips2-edex-shapefiles
|
||||
Summary: AWIPS II Edex
|
||||
Version: 1.7.1
|
||||
Release: 1
|
||||
Version: %{_component_version}
|
||||
Release: %{_component_release}
|
||||
Group: AWIPSII
|
||||
BuildRoot: %{_build_root}
|
||||
BuildArch: noarch
|
||||
|
|
|
@ -5,6 +5,8 @@ function buildQPID()
|
|||
# Arguments:
|
||||
# ${1} == optionally -ade
|
||||
|
||||
pushd . > /dev/null 2>&1
|
||||
|
||||
cd ${WORKSPACE}/rpms/awips2.qpid/deploy.builder
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: Failed to build the qpid rpms."
|
||||
|
@ -69,6 +71,8 @@ function buildQPID()
|
|||
fi
|
||||
fi
|
||||
|
||||
popd > /dev/null 2>&1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue