Merge branch 'master_14.2.2' into master_14.2.4 CM-MERGE:14.2.2-25-29 into 14.2.4

Conflicts:
	edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscMosaic.py

Former-commit-id: dd9d7133d9 [formerly 325887e605 [formerly 65e2373d13c7d5b33d579b87d98a8265252ea391]]
Former-commit-id: 325887e605
Former-commit-id: 2ddc920a4a
This commit is contained in:
Brian.Dyke 2014-08-22 14:16:22 -04:00
commit 6402cb7d89
34 changed files with 820 additions and 197 deletions

View file

@ -104,6 +104,7 @@ import com.vividsolutions.jts.geom.LineString;
* 06-03-14 3191 njensen Fix postData to not retrieve
* 06-17-2014 DR17409 mgamazaychikov Fix futurePoints calculation in generateNewTrackInfo()
* and generateExistingTrackInfo()
* 08-21-2014 DR 17500 Qinglu Lin handle the situation where frameTime is null in paintTrack().
*
* </pre>
*
@ -690,11 +691,12 @@ public class StormTrackDisplay implements IRenderable {
return;
}
if (state.geomChanged) {
DataTime frameTime = paintProps.getDataTime();
if (frameTime != null && state.geomChanged) {
if (cachedTrack != null) {
cachedTrack.dispose();
}
generateTrackInfo(state, paintProps);
generateTrackInfo(state, paintProps, frameTime);
if (state.mode == Mode.TRACK) {
createTrack(target, paintProps);
}
@ -714,7 +716,7 @@ public class StormTrackDisplay implements IRenderable {
* @param currentState
*/
private void generateTrackInfo(StormTrackState currentState,
PaintProperties paintProps) throws VizException {
PaintProperties paintProps, DataTime frameTime) throws VizException {
int frameCount = trackUtil.getFrameCount(paintProps.getFramesInfo());
int currFrame = trackUtil.getCurrentFrame(paintProps.getFramesInfo());
try {
@ -727,7 +729,6 @@ public class StormTrackDisplay implements IRenderable {
&& currentState.timePoints.length != frameCount) {
// need to set theAnchorPoint and theAnchorIndex here
// because timePoints get erased before we get to updateAnchorPoint
DataTime frameTime = paintProps.getDataTime();
for (int j=0;j<currentState.timePoints.length;j++){
if (frameTime.equals(currentState.timePoints[j].time)) {
theAnchorPoint = currentState.timePoints[j].coord;
@ -774,7 +775,7 @@ public class StormTrackDisplay implements IRenderable {
generateNewTrackInfo(currentState, currFrame, paintProps);
currentDisplayedTimes = trackUtil.getDataTimes(paintProps
.getFramesInfo());
generateTrackInfo(currentState, paintProps);
generateTrackInfo(currentState, paintProps, frameTime);
} else {
if (currentState.pointMoved) {

View file

@ -48,6 +48,7 @@ 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.TimeRange;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.HDF5Util;
import com.raytheon.uf.viz.core.IExtent;
@ -94,6 +95,7 @@ import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
* fields when magnification set to 0
* Feb 27, 2013 DCS 152 jgerth/elau Support for WWLLN and multiple sources
* Jun 6, 2014 DR 17367 D. Friedman Fix cache object usage.
* Aug 04, 2014 3488 bclement added sanity check for record bin range
*
* </pre>
*
@ -107,6 +109,8 @@ public class LightningResource extends
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(LightningResource.class);
private static final long MAX_RECORD_BIN_MILLIS = TimeUtil.MILLIS_PER_DAY;
private static class LightningFrame {
public LightningFrameMetadata metadata;
@ -507,6 +511,13 @@ public class LightningResource extends
for (BinLightningRecord obj : objs) {
if (obj.getLightSource().equals(this.lightSource) || this.lightSource.isEmpty()) {
long duration = obj.getDataTime().getValidPeriod()
.getDuration();
if (duration > MAX_RECORD_BIN_MILLIS) {
statusHandler.error("Record bin time larger than maximum "
+ "supported period. Skipping record: " + obj);
continue;
}
DataTime time = new DataTime(obj.getStartTime());
DataTime end = new DataTime(obj.getStopTime());
time = this.getResourceData().getBinOffset()

View file

@ -253,7 +253,7 @@ public class SatResource extends
initializeFirstFrame((SatelliteRecord) pdo);
} catch (VizException e) {
throw new IllegalStateException(
"Unable to initialize the satellite resource");
"Unable to initialize the satellite resource", e);
}
initialized = true;
}

View file

@ -57,6 +57,7 @@ import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.viz.core.mode.CAVEMode;
import com.raytheon.viz.warngen.gui.WarngenLayer;
import com.raytheon.viz.warngen.gui.WarngenLayer.GeoFeatureType;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.Polygon;
@ -70,6 +71,7 @@ import com.vividsolutions.jts.geom.Polygon;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 17, 2014 3419 jsanchez Initial creation
* Aug 20, 2014 ASM #16703 D. Friedman Ensure watches have a state attribute.
*
* </pre>
*
@ -173,7 +175,8 @@ public class WatchUtil {
}
DbQueryRequest request = buildRequest(simulatedTime,
phenSigConstraint.toString(), warngenLayer.getAllUgcs(),
phenSigConstraint.toString(),
warngenLayer.getAllUgcs(GeoFeatureType.COUNTY),
entityClass);
DbQueryResponse response = (DbQueryResponse) ThriftClient
.sendRequest(request);
@ -190,7 +193,7 @@ public class WatchUtil {
System.out.println("create watch area buffer time: "
+ (System.currentTimeMillis() - t0));
Set<String> validUgcZones = warngenLayer
.getUgcsForWatches(watchArea);
.getUgcsForWatches(watchArea, GeoFeatureType.COUNTY);
watches = processRecords(records, validUgcZones);
} catch (RuntimeException e) {
statusHandler
@ -327,6 +330,14 @@ public class WatchUtil {
*/
String ugcZone = ar.getUgcZone();
String state = getStateName(ugcZone.substring(0, 2));
/*
* Temporary fix for SS DR #16703. Remove when marine watch wording
* is fixed.
*/
if (state == null)
continue;
String action = ar.getAct();
String phenSig = ar.getPhensig();
String etn = ar.getEtn();
@ -360,7 +371,16 @@ public class WatchUtil {
@Override
public int compare(Watch watch1, Watch watch2) {
return watch1.getState().compareTo(watch2.getState());
String state1 = watch1.getState();
String state2 = watch2.getState();
if (state1 == state2)
return 0;
else if (state1 == null)
return 1; // null state is greater; put at end
else if (state2 == null)
return -1;
else
return state1.compareTo(state2);
}
});

View file

@ -212,6 +212,7 @@ import com.vividsolutions.jts.io.WKTReader;
* 07/01/2014 DR 17450 D. Friedman Use list of templates from backup site.
* 07/28/2014 DR 17475 Qinglu Lin Updated populateStrings() and findLargestQuadrant(), removed findLargestGeometry(),
* added createAreaAndCentroidMaps() and movePopulatePt(), updated paintText() to center W.
* 08/20/2014 ASM #16703 D. Friedman Make geo feature types for watches explicit
* </pre>
*
* @author mschenke
@ -1509,50 +1510,42 @@ public class WarngenLayer extends AbstractStormTrackResource {
return null;
}
public enum GeoFeatureType {
COUNTY("county", "FIPS"), MARINE("marinezones", "ID");
final private String tableName;
final private String fipsField;
private GeoFeatureType(String tableName, String fipsField) {
this.tableName = tableName;
this.fipsField = fipsField;
}
}
/**
* Returns a set of UGCs for each area in the CWA that intersects the given
* polygon.
*/
public Set<String> getUgcsForWatches(Polygon polygon)
public Set<String> getUgcsForWatches(Polygon polygon, GeoFeatureType type)
throws Exception {
GeospatialDataAccessor gda = getGeospatialDataAcessor();
boolean isMarineZone = configuration.getGeospatialConfig()
.getAreaSource().equalsIgnoreCase(MARINE);
if (!isMarineZone) {
Set<String> ugcs = new HashSet<String>();
for (String fips : gda.getAllFipsInArea(gda.buildArea(polygon))) {
ugcs.add(FipsUtil.getUgcFromFips(fips));
}
return ugcs;
} else {
Set<String> ids = new HashSet<String>();
Geometry g = gda.buildArea(polygon);
ids = getAllFipsInArea(g);
return ids;
}
Set<String> ugcs = new HashSet<String>();
GeospatialDataAccessor gda = getGeospatialDataAcessor(type);
for (String fips : gda.getAllFipsInArea(gda.buildArea(polygon)))
ugcs.add(FipsUtil.getUgcFromFips(fips));
return ugcs;
}
public Set<String> getAllUgcs() throws Exception {
GeospatialDataAccessor gda;
public Set<String> getAllUgcs(GeoFeatureType type) throws Exception {
// TODO: zig
GeospatialDataAccessor gda = getGeospatialDataAcessor(type);
Set<String> ugcs = new HashSet<String>();
gda = getGeospatialDataAcessor();
boolean isMarineZone = configuration.getGeospatialConfig()
.getAreaSource().equalsIgnoreCase(MARINE);
if (!isMarineZone) {
for (GeospatialData r : gda.geoData.features) {
ugcs.add(FipsUtil.getUgcFromFips(gda.getFips(r)));
}
} else {
for (GeospatialData r : gda.geoData.features) {
ugcs.add(getFips(r));
}
for (GeospatialData r : gda.geoData.features) {
ugcs.add(FipsUtil.getUgcFromFips(gda.getFips(r)));
}
return ugcs;
}
private GeospatialDataAccessor getGeospatialDataAcessor()
private GeospatialDataAccessor getGeospatialDataAcessor(GeoFeatureType type)
throws Exception {
GeospatialDataList gdl = searchGeospatialDataAccessor();
GeospatialDataList gdl = searchGeospatialDataAccessor(type);
if (gdl == null) {
// Cause county geospatial data to be loaded
/*
@ -1562,36 +1555,33 @@ public class WarngenLayer extends AbstractStormTrackResource {
* the filename. What happens in the future if the base file gets
* changed again? A ticket should be opened for this to be resolved.
*/
WarngenConfiguration torConfig = WarngenConfiguration.loadConfig(
"tornadoWarning", getLocalizedSite(), null);
loadGeodataForConfiguration(torConfig);
gdl = searchGeospatialDataAccessor();
String templateName;
if (type == GeoFeatureType.COUNTY)
templateName = "tornadoWarning";
else if (type == GeoFeatureType.MARINE)
templateName = "specialMarineWarning";
else
throw new IllegalArgumentException("Unsupported geo feature type " + type);
WarngenConfiguration config = WarngenConfiguration.loadConfig(
templateName, getLocalizedSite(), null);
loadGeodataForConfiguration(config);
gdl = searchGeospatialDataAccessor(type);
}
// TODO: There should be some way to get the "county" configuration by
// name
// independent of a template
// TODO: FIPS field should not be hardcoded.
AreaSourceConfiguration areaConfig = new AreaSourceConfiguration();
areaConfig.setFipsField("FIPS");
areaConfig.setFipsField(type.fipsField);
return new GeospatialDataAccessor(gdl, areaConfig);
}
private GeospatialDataList searchGeospatialDataAccessor() {
private GeospatialDataList searchGeospatialDataAccessor(GeoFeatureType type) {
synchronized (siteMap) {
for (Map.Entry<String, GeospatialDataList> entry : siteMap
.entrySet()) {
String[] keyParts = entry.getKey().split("\\.");
boolean isMarineZone = configuration.getGeospatialConfig()
.getAreaSource().equalsIgnoreCase(MARINE);
String mapdataTable = null;
if (!isMarineZone) {
mapdataTable = "county";
} else {
mapdataTable = "marinezones";
}
if (keyParts.length == 2
&& mapdataTable.equalsIgnoreCase(keyParts[0])
&& type.tableName.equalsIgnoreCase(keyParts[0])
&& getLocalizedSite().equals(keyParts[1])) {
return entry.getValue();
}

View file

@ -140,6 +140,7 @@ import com.vividsolutions.jts.io.WKTReader;
* Mar 17, 2014 DR 16309 Qinglu Lin Updated getWatches(), processATEntries() and determineAffectedPortions(), and
* added determineAffectedMarinePortions().
* Jul 21, 2014 3419 jsanchez Refactored WatchUtil.
* Aug 15, 2014 DR15701 mgamazaychikov Removed static field watchUtil.
* </pre>
*
* @author njensen
@ -157,8 +158,6 @@ public class TemplateRunner {
private static Hashtable<String, DateFormat> dateFormat;
private static WatchUtil watchUtil;
static {
dateFormat = new Hashtable<String, DateFormat>();
dateFormat
@ -851,9 +850,7 @@ public class TemplateRunner {
// Store Watches
try {
t0 = System.currentTimeMillis();
if (watchUtil == null) {
watchUtil = new WatchUtil(warngenLayer);
}
WatchUtil watchUtil = new WatchUtil(warngenLayer);
List<Watch> watches = watchUtil.getWatches(config, warnPolygon,
simulatedTime);
System.out.println("getWatches time: "

View file

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# This script will update any saved displays which use older skewT displays to
# use Nsharp.
#

View file

@ -0,0 +1,31 @@
#!/usr/bin/env python
# This script will update any saved displays or procedures with the old Topo file name
#
# This update only needs to be run if there are saved displays being stored
# outside of localization, for procedures saved in localization,
# updateTopoFile.sh will automatically call this.
import sys
import xml.etree.ElementTree as ET
xsitype = '{http://www.w3.org/2001/XMLSchema-instance}type'
def upgradeBundle(bundleFile):
tree = ET.parse(bundleFile)
root = tree.getroot()
iterpath = 'bundles/bundle/displayList/displays'
if root.tag == 'bundle':
iterpath = 'displayList/displays'
for display in root.iterfind(iterpath):
if display.get(xsitype) == "d2DMapRenderableDisplay":
for resourceData in display.iterfind('descriptor/resource/resourceData'):
if resourceData.get(xsitype) == 'topoResourceData':
for topoFile in resourceData.iterfind('topoFile'):
if topoFile.text == 'srtm30.hdf':
topoFile.text = 'defaultTopo.h5'
tree.write(bundleFile)
if __name__ == '__main__':
for arg in sys.argv[1:]:
upgradeBundle(arg)

View file

@ -0,0 +1,24 @@
#!/bin/bash
# This script will update any D2D procedures files
# which use the old Topo file name
IFS=$'\n'
files=`ls /awips2/edex/data/utility/cave_static/*/*/procedures/*.xml`
if [ $? -ne 0 ]; then
echo "No procedures found"
exit 1
fi
MY_DIR=`dirname $0`
for f in $files; do
grep 'srtm30.hdf' $f > /dev/null
if [ $? -eq 0 ]; then
echo Updating $f
python $MY_DIR/updateTopoFile.py $f
fi
done
echo "INFO: the update has completed successfully!"
exit 0

View file

@ -72,6 +72,7 @@ export SHLIB_PATH=$PROJECT/sharedlib
### End AWIPS 1 support ###
export HOSTNAME=`hostname`
export SHORT_HOSTNAME=`hostname -s`
# set Python & Java into the path
export PATH=$awips_home/bin:${JAVA_INSTALL}/bin:${PYTHON_INSTALL}/bin:$PATH

View file

@ -0,0 +1,180 @@
#!/bin/sh
#####################################################################
# 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.
#####################################################################
#####################################################################
# Script for capturing data from a wrapper java process when the
# wrapper restarts the process
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------- -------- ----------- --------------------------
# Aug 07, 2014 3470 rjpeter Initial creation
#
#####################################################################
# NOTE: Script must be located at /awips2/qpid/bin/yajsw/scripts for it to work
# base path to save capture data to, will create subdirectory for each server
basePath="/data/fxa/cave"
state=$1
string_state=$2
pid=$4
path_to_script=`readlink -f $0`
curTime=`date +%Y%m%d_%H%M%S`
echo "$curTime: Wrapper running $path_to_script due to state transition for pid $pid. New State $state|$string_state"
# ensure directory is created and has write permissions
checkDir() {
dir="$1"
if [ ! -d "$dir" ]; then
mkdir -p $dir
if [ ! -d "$dir" ]; then
message="Unable to create qpid capture data directory\n$dir"
echo -e "Capture failed: $message"
exit 1
fi
fi
if [ ! -w "$dir" ]; then
message="Do not have write permissions to qpid capture data directory\n$dir"
echo -e "Capture failed: $message"
exit 1
fi
}
# gets top output of local server
runTop() {
local curTime=`date "+%Y%m%d_%H:%M:%S"`
echo "$curTime: Capturing top"
echo "$curTime: Capturing top" >> $processFile
local out_file="${dataPath}/top.log"
export COLUMNS=160
top -b -c -n1 >> $out_file 2>&1
curTime=`date +%Y%m%d_%H%M%S`
echo "$curTime: top captured"
}
# runs jstack 10 times, if it fails will run again with -F
runJstack() {
local curTime=`date +%Y%m%d_%H%M%S`
echo "$curTime: Capturing jstacks"
local pid="$1"
local count=1
local cmd="/awips2/java/bin/jstack"
local prePath="${dataPath}/pid_${pid}_"
local log=""
while [ "$count" -le "10" ]; do
curTime=`date "+%Y%m%d_%H:%M:%S"`
log="${prePath}jstack_${count}.log"
echo "${curTime}: Running command: ${cmd} ${pid} >> ${log} 2>&1" >> $processFile
echo "Running for $curTime" >> $log
${cmd} ${pid} >> ${log} 2>&1
if [[ "$?" != "0" && $FORCE != "y" ]]; then
curTime=`date "+%Y%m%d_%H:%M:%S"`
echo "${curTime}: jstack for $pid failed to connect, rerunning with -F" >> $processFile
${cmd} -F ${pid} >> ${log} 2>&1
fi
let "count+=1"
done
curTime=`date +%Y%m%d_%H%M%S`
echo "$curTime: jstacks captured"
}
# runs jmap -heap
runJmapHeap() {
local curTime=`date +%Y%m%d_%H%M%S`
echo "$curTime: Capturing jmap -heap"
local pid=$1
local prePath="${dataPath}/pid_${pid}_"
local log="${prePath}jmapHeap.log"
local cmd="/awips2/java/bin/jmap -heap"
echo "${curTime}: Running command: $cmd $pid >> $log 2>&1" >> $processFile
$cmd $pid >> $log 2>&1
if [[ "$?" != "0" && $FORCE != "y" ]]; then
curTime=`date "+%Y%m%d_%H:%M:%S"`
echo "${curTime}: jmap for $pid failed to connect, rerunning with -F" >> $processFile
$cmd -F $pid >> $log 2>&1
fi
curTime=`date +%Y%m%d_%H%M%S`
echo "$curTime: jmap -heap captured"
}
# runs jmap, if it fails will run again with -F
runJmap() {
local curTime=`date +%Y%m%d_%H%M%S`
echo "$curTime: Capturing jmap -dump"
local pid=$1
local prePath="${dataPath}/pid_${pid}_jmap"
local log="${prePath}.log"
local dumpPath="${prePath}.hprof"
local cmd="/awips2/java/bin/jmap -dump:format=b,file=${dumpPath}"
echo "${curTime}: Running command: $cmd $pid >> $log 2>&1" >> $processFile
$cmd $pid >> $log 2>&1
if [[ "$?" != "0" && $FORCE != "y" ]]; then
curTime=`date "+%Y%m%d_%H:%M:%S"`
echo "${curTime}: jmap for $pid failed to connect, rerunning with -F" >> $processFile
$cmd -F $pid >> $log 2>&1
fi
curTime=`date +%Y%m%d_%H%M%S`
echo "$curTime: jmap -dump captured"
}
if [[ "$pid" != "-1" ]]; then
process=`ps -ef | grep $pid | grep java`
if [[ "$process" != "" ]]; then
hostName=`hostname -s`
dataPath="${basePath}/${hostName}/wrapperCaptureData_${curTime}_pid_$pid"
checkDir $dataPath
processFile=${dataPath}/capture_info.log
echo "Wrapper running $0 due to state transition for pid $pid. New State $state|$string_state" >> $processFile
echo "Process information:" >> $processFile
ps -ef | grep $pid >> $processFile
runTop &
runJstack $pid &
runJmapHeap $pid &
# TODO: Double check if jvm already dumped one
runJmap $pid &
wait
curTime=`date +%Y%m%d_%H%M%S`
echo "$curTime: Data captured to $dataPath"
else
curTime=`date +%Y%m%d_%H%M%S`
echo "$curTime: PID $pid is no longer running, nothing to capture"
fi
else
curTime=`date +%Y%m%d_%H%M%S`
echo "$curTime: PID was -1, process no longer running, nothing to capture"
fi

View file

@ -99,6 +99,8 @@ wrapper.java.additional.6=-Djava.util.Arrays.useLegacyMergeSort=true
# garbage collection settings
wrapper.java.additional.gc.1=-XX:+UseConcMarkSweepGC
wrapper.java.additional.gc.2=-XX:+CMSIncrementalMode
wrapper.java.additional.gc.3=-XX:+HeapDumpOnOutOfMemoryError
wrapper.java.additional.gc.4=-XX:HeapDumpPath=/data/fxa/cave/${SHORT_HOSTNAME}/
# use qpid binding URL instead of default address string format
wrapper.java.additional.qpid.1=-Dqpid.dest_syntax=BURL
@ -163,7 +165,13 @@ wrapper.java.app.mainclass=com.raytheon.uf.edex.esb.Main
# Application parameters. Add parameters as needed starting from 2
wrapper.app.parameter.2=start
wrapper.ping.timeout=300
wrapper.ping.timeout=30
# NOTE: script must be located at /awips2/qpid/bin/yajsw/scripts for it to be found
wrapper.script.ABORT=wrapperCapture.sh
wrapper.script.ABORT.timeout=120
wrapper.script.RESTART=wrapperCapture.sh
wrapper.script.RESTART.timeout=120
#********************************************************************
# Monitor the Application
@ -174,15 +182,16 @@ wrapper.java.monitor.heap.threshold.percent = 90
wrapper.java.monitor.deadlock = true
# application will be restarted and a warning message will be logged
wrapper.filter.action.deadlock.restart=${WRAPPER_DEADLOCK_ACTION}
wrapper.filter.trigger.deadlock=wrapper.java.monitor.deadlock: DEADLOCK IN THREADS:
wrapper.filter.action.deadlock=${WRAPPER_DEADLOCK_ACTION}
# restart the application if it crashes
wrapper.on_exit.default=${WRAPPER_ON_EXIT_ACTION}
# restart the application if it runs out of memory
wrapper.trigger.1=java.lang.OutOfMemoryError
wrapper.trigger.action=${WRAPPER_TRIGGER_ACTION}
wrapper.filter.trigger.oom=java.lang.OutOfMemoryError
wrapper.filter.action.oom=${WRAPPER_TRIGGER_ACTION}
#********************************************************************
#********************************************************************fil
# Wrapper Logging Properties
#********************************************************************
# Format of output for the console. (See docs for formats)

View file

@ -22,8 +22,14 @@ package com.raytheon.edex.plugin.binlightning;
import gov.noaa.nws.ost.edex.plugin.binlightning.BinLigntningDecoderUtil;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TimeZone;
import org.apache.commons.logging.Log;
@ -33,12 +39,12 @@ import com.raytheon.edex.esb.Headers;
import com.raytheon.edex.exception.DecoderException;
import com.raytheon.edex.plugin.AbstractDecoder;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord;
import com.raytheon.uf.common.dataplugin.binlightning.impl.LightningStrikePoint;
import com.raytheon.uf.common.dataplugin.binlightning.impl.LtgStrikeType;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.edex.decodertools.core.DecoderTools;
import com.raytheon.uf.edex.decodertools.time.TimeTools;
import com.raytheon.uf.edex.wmo.message.WMOHeader;
@ -82,6 +88,7 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
* Jan 24, 2014 DR 16774 Wufeng Zhou Modified for updated Bin-lightning data spec,
* and to used WMO header to distinguish bit-shifted
* GLD360 and NLDN data.
* Aug 04, 2014 3488 bclement added checkBinRange(), rebin() and finalizeRecords()
*
* </pre>
*
@ -100,6 +107,9 @@ public class BinLightningDecoder extends AbstractDecoder {
private final Log logger = LogFactory.getLog(getClass());
private static final boolean REBIN_INVALID_DATA = Boolean
.getBoolean("rebin.invalid.binlightning");
/**
* Default lightning strike type for FLASH messages. RT_FLASH documents
* indicate no default, but D2D code defaults to STRIKE_CG also.
@ -127,7 +137,7 @@ public class BinLightningDecoder extends AbstractDecoder {
public PluginDataObject[] decode(byte[] data, Headers headers) throws DecoderException {
//String traceId = null;
PluginDataObject[] reports = new PluginDataObject[0];
PluginDataObject[] rval = new PluginDataObject[0];
if (data != null) {
traceId = (String) headers.get(DecoderTools.INGEST_FILE_NAME);
@ -163,11 +173,13 @@ public class BinLightningDecoder extends AbstractDecoder {
// both encrypted data and legacy data
//
List<LightningStrikePoint> strikes = BinLigntningDecoderUtil.decodeBinLightningData(data, pdata, traceId, wmoHdr, baseTime.getTime());
Collection<LightningStrikePoint> strikes = BinLigntningDecoderUtil
.decodeBinLightningData(data, pdata, traceId, wmoHdr,
baseTime.getTime());
if (strikes == null) { // keep-alive record, log and return
logger.info(traceId + " - found keep-alive record. ignore for now.");
return reports;
return rval;
}
//
@ -186,44 +198,133 @@ public class BinLightningDecoder extends AbstractDecoder {
return new PluginDataObject[0];
}
Calendar c = TimeTools.copy(baseTime);
if (c == null) {
throw new DecoderException(traceId + " - Error decoding times");
}
//report.setInsertTime(c); // OB13.4 source code does not have this line anymore, WZ 05/03/2013
Calendar cStart = report.getStartTime();
if (cStart.getTimeInMillis() > (c.getTimeInMillis() + TEN_MINUTES)) {
synchronized (SDF) {
logger.info("Discarding future data for " + traceId
+ " at " + SDF.format(cStart.getTime()));
}
} else {
Calendar cStop = report.getStopTime();
TimeRange range = new TimeRange(cStart.getTimeInMillis(),
cStop.getTimeInMillis());
DataTime dataTime = new DataTime(cStart, range);
report.setDataTime(dataTime);
if (report != null) {
report.setTraceId(traceId);
//report.setPluginName("binlightning"); // line disappear in OB15.5.3
try {
report.constructDataURI();
reports = new PluginDataObject[] { report };
} catch (PluginException e) {
logger.error("Error constructing datauri", e);
throw new DecoderException("Error constructing datauri", e);
}
}
}
Collection<BinLightningRecord> records = checkBinRange(report,
strikes);
rval = finalizeRecords(records, baseTime);
}
} else {
logger.error("No WMOHeader found in data");
}
return reports;
return rval;
}
/**
* Perform final actions on each record and populate a PDO array with them.
* Any invalid records will be omitted from the return array.
*
* @param records
* @param baseTime
* @return
* @throws DecoderException
*/
private PluginDataObject[] finalizeRecords(
Collection<BinLightningRecord> records, Calendar baseTime)
throws DecoderException {
Calendar c = TimeTools.copy(baseTime);
if (c == null) {
throw new DecoderException(traceId + " - Error decoding times");
}
ArrayList<BinLightningRecord> rval = new ArrayList<BinLightningRecord>(
records.size());
for (BinLightningRecord record : records) {
Calendar cStart = record.getStartTime();
if (cStart.getTimeInMillis() > (c.getTimeInMillis() + TEN_MINUTES)) {
synchronized (SDF) {
logger.info("Discarding future data for " + traceId
+ " at " + SDF.format(cStart.getTime()));
}
} else {
Calendar cStop = record.getStopTime();
TimeRange range = new TimeRange(cStart.getTimeInMillis(),
cStop.getTimeInMillis());
DataTime dataTime = new DataTime(cStart, range);
record.setDataTime(dataTime);
if (record != null) {
record.setTraceId(traceId);
rval.add(record);
}
}
}
return rval.toArray(new PluginDataObject[rval.size()]);
}
/**
* Ensure that the record has a valid bin range. If it does, it will be the
* only record in the return value. Otherwise, {@link #REBIN_INVALID_DATA}
* is used to determine if no records should be returned or the strikes
* should be split into valid bin ranges uses {@link #rebin(Collection)}
*
* @param record
* @param strikes
* @return
*/
private Collection<BinLightningRecord> checkBinRange(
BinLightningRecord record, Collection<LightningStrikePoint> strikes) {
Collection<BinLightningRecord> rval = Collections.emptyList();
Calendar cStart = record.getStartTime();
Calendar cStop = record.getStopTime();
long binRange = cStop.getTimeInMillis() - cStart.getTimeInMillis();
if (binRange > TimeUtil.MILLIS_PER_DAY) {
if (REBIN_INVALID_DATA) {
rval = rebin(strikes);
} else {
String rangeStart;
String rangeEnd;
synchronized (SDF) {
rangeStart = SDF.format(cStart.getTime());
rangeEnd = SDF.format(cStop.getTime());
}
logger.error("Discarding data with invalid bin range of "
+ rangeStart + " to " + rangeEnd);
}
} else {
rval = Arrays.asList(record);
}
return rval;
}
/**
* Split the strikes into 1 day bins and create a new record for each bin
*
* @param strikes
* @return
*/
private Collection<BinLightningRecord> rebin(
Collection<LightningStrikePoint> strikes) {
Map<Long, Collection<LightningStrikePoint>> binMap = new HashMap<Long, Collection<LightningStrikePoint>>(
1);
for (LightningStrikePoint strike : strikes) {
Calendar c = TimeTools.getBaseCalendar(strike.getYear(),
strike.getMonth(), strike.getDay());
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
c.set(Calendar.MILLISECOND, 0);
long key = c.getTimeInMillis();
Collection<LightningStrikePoint> bin = binMap.get(key);
if (bin == null) {
bin = new ArrayList<LightningStrikePoint>(strikes.size());
binMap.put(key, bin);
}
bin.add(strike);
}
Collection<BinLightningRecord> rval = new ArrayList<BinLightningRecord>(
binMap.size());
for (Entry<Long, Collection<LightningStrikePoint>> e : binMap
.entrySet()) {
Collection<LightningStrikePoint> bin = e.getValue();
BinLightningRecord record = new BinLightningRecord(bin.size());
for (LightningStrikePoint strike : bin) {
record.addStrike(strike);
}
rval.add(record);
}
return rval;
}
/**

View file

@ -49,7 +49,7 @@ from com.raytheon.uf.common.dataplugin.level import LevelFactory
from com.raytheon.edex.plugin.grib.spatial import GribSpatialCache
from com.raytheon.edex.util.grib import GribTableLookup
from com.raytheon.edex.util import Util
from com.raytheon.uf.common.util import GridUtil
from com.raytheon.edex.util.grib import GribParamTranslator
@ -123,6 +123,8 @@ logHandler = UFStatusHandler.UFStatusHandler("com.raytheon.edex.plugin.grib", "E
# grib files.
# Feb 11, 2014 2765 bsteffen Better handling of probability parameters.
# Apr 28, 2014 3084 bsteffen Use full grid for looking up parameter aliases.
# Aug 15, 2014 15699 MPorricelli Import GridUtil and update reference
# to GRID_FILL_VALUE
#
class GribDecoder():
@ -333,7 +335,7 @@ class GribDecoder():
subGridDataArray = numpy.zeros((subny, subnx), numpy.float32)
midx = nx - startx
subGridDataArray[0:subny, 0:midx] = numpyDataArray[starty:endY, startx:nx]
subGridDataArray[0:subny, midx:subnx] = Util.GRID_FILL_VALUE
subGridDataArray[0:subny, midx:subnx] = GridUtil.GRID_FILL_VALUE
numpyDataArray = subGridDataArray
else:
numpyDataArray = numpyDataArray[starty:endY, startx:endX]

View file

@ -126,6 +126,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
* 06/26/2014 3321 mpduff Fix ingestSwitchMap checks
* 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
* </pre>
*
* @author mduff
@ -2150,7 +2151,6 @@ public class PostShef {
ingestSwitchMap.put(key, ingestSwitch);
}
matchFound = ingestSwitchMap.containsKey(key);
ingestSwitch = ingestSwitchMap.get(key);
/*

View file

@ -53,9 +53,11 @@ import org.apache.http.HttpResponse;
import org.apache.http.HttpResponseInterceptor;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.AuthCache;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.client.protocol.ClientContext;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.ConnectionPoolTimeoutException;
import org.apache.http.conn.params.ConnRoutePNames;
@ -67,9 +69,12 @@ import org.apache.http.conn.ssl.X509HostnameVerifier;
import org.apache.http.entity.AbstractHttpEntity;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.auth.BasicScheme;
import org.apache.http.impl.client.BasicAuthCache;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.EntityUtils;
@ -106,6 +111,7 @@ import com.raytheon.uf.common.util.ByteArrayOutputStreamPool.ByteArrayOutputStre
* DynamicSerializeStreamHandler
* Feb 04, 2014 2704 njensen Better error message with bad address
* Https authentication failures notify handler
* Aug 15, 2014 3524 njensen Pass auth credentials on every https request
*
* </pre>
*
@ -396,6 +402,20 @@ public class HttpClient {
private IHttpsConfiguration httpsConfiguration;
/**
* The authCache is for https requests only. Without the authCache, inside
* DefaultRequestDirector.execute() it will always attempt to connect to the
* https address without the credentials set, therefore receiving a 401 not
* authenticated, THEN apply the credentials we already validated and try
* again. ON EVERY SINGLE REQUEST. Without the authCache therefore every
* https request actually becomes two requests.
*
* There may be other ways to work around this limitation that could be
* investigated as time allows. A newer version of apache httpclient may
* also alleviate this.
*/
private AuthCache authCache;
/**
* Private constructor.
*/
@ -511,7 +531,11 @@ public class HttpClient {
HttpResponse resp = null;
if (put.getURI().getScheme().equalsIgnoreCase(HTTPS)) {
org.apache.http.client.HttpClient client = getHttpsInstance();
resp = execute(client, put);
HttpContext context = new BasicHttpContext();
if (authCache != null) {
context.setAttribute(ClientContext.AUTH_CACHE, authCache);
}
resp = execute(client, put, context);
// Check for not authorized, 401
while (resp.getStatusLine().getStatusCode() == 401) {
@ -533,8 +557,9 @@ public class HttpClient {
this.setCredentials(host, port, null, credentials[0],
credentials[1]);
context.setAttribute(ClientContext.AUTH_CACHE, authCache);
try {
resp = execute(client, put);
resp = execute(client, put, context);
} catch (Exception e) {
statusHandler.handle(Priority.ERROR,
"Error retrying http request", e);
@ -562,19 +587,29 @@ public class HttpClient {
}
/**
* Execute the HttpUriRequest using the provided HttpClient instance.
* Execute the HttpUriRequest using the provided HttpClient instance and
* context.
*
* @param client
* The HttpClient instance
* @param request
* The request
* @param context
* The context
*
* @return HttpResponse
* @throws ClientProtocolException
* @throws IOException
*/
private HttpResponse execute(org.apache.http.client.HttpClient client,
HttpUriRequest request) throws ClientProtocolException, IOException {
return client.execute(request);
HttpUriRequest request, HttpContext context)
throws ClientProtocolException, IOException {
/*
* The apache http client will fill in values not set on the context
* with defaults. See AbstractHttpClient line 801 where it does:
* execContext = new DefaultedHttpContext(context, defaultContext);
*/
return client.execute(request, context);
}
/**
@ -1185,6 +1220,10 @@ public class HttpClient {
(HttpsHolder.sslClient).getCredentialsProvider().setCredentials(
new AuthScope(host, port),
new UsernamePasswordCredentials(username, password));
if(this.authCache == null) {
this.authCache = new BasicAuthCache();
}
authCache.put(new HttpHost(host, port, HTTPS), new BasicScheme());
}
/**

View file

@ -49,7 +49,7 @@
<contourStyle>
<displayUnits>ft</displayUnits>
<contourLabeling labelSpacing="4" labelFormat="#">
<increment>50</increment>
<increment>1000</increment>
</contourLabeling>
</contourStyle>
</styleRule>

View file

@ -189,20 +189,27 @@ ${drainage.name}##
########END MACRO
#macro(inserttorwatches $watches $list $secondtimezone $dateUtil $timeFormat)
#set($tornadoWatches = [])
#set($keys = [])
#set($mymap = {})
#foreach(${watch} in ${watches})
#if(${watch.getPhenSig()} == 'TO.A')
#set($success = $tornadoWatches.add($watch))
#set($endTime = ${watch.endTime})
#if(!$latestEndTime || ${endTime.after($latestEndTime)})
#set($latestEndTime = ${endTime})
#set($key = ${watch.action} + ${watch.etn} + ${watch.startTime} + ${watch.endTime})
#if (${list.contains(${keys}, $key)})
#set($value = ${mymap.get($key)})
#else
#set($value = [])
#set($success = $keys.add($key))
#end
#set($success = $value.add($watch))
#set($success = ${mymap.put($key,$value)})
#end
#end
#end
#if(!${list.isEmpty($tornadoWatches)})
A TORNADO WATCH REMAINS IN EFFECT UNTIL ${dateUtil.format(${latestEndTime}, ${timeFormat.plain}, 15, ${localtimezone})}##
${dateUtil.period(${latestEndTime},${timeFormat.plain}, 15, ${localtimezone})}##
#set($torWatchAlso = "")
#foreach(${key} in ${keys})
#set($tornadoWatches = ${mymap.get($key)})
#set($tornadoWatch = ${tornadoWatches.get(0)})
A TORNADO WATCH ${torWatchAlso}REMAINS IN EFFECT UNTIL ${dateUtil.format(${tornadoWatch.endTime}, ${timeFormat.plain}, 15, ${localtimezone})}##
${dateUtil.period(${tornadoWatch.endTime},${timeFormat.plain}, 15, ${localtimezone})}##
#if(${secondtimezone})
/${dateUtil.format(${watch.getEndTime()}, ${timeFormat.plain}, 15, ${secondtimezone})}/##
#end
@ -218,27 +225,36 @@ ${dateUtil.period(${latestEndTime},${timeFormat.plain}, 15, ${localtimezone})}##
...##
#end
#end
#set($torWatchAlso = "ALSO ")
. ##
#end
#end
########END MACRO
#macro(insertsvrwatches $watches $list $secondtimezone $dateUtil $timeFormat)
#set($severeWatches = [])
#set($keys = [])
#set($mymap = {})
#foreach(${watch} in ${watches})
#if(${watch.getPhenSig()} == 'SV.A')
#set($success = $severeWatches.add($watch))
#set($endTime = ${watch.endTime})
#if(!$latestEndTime || ${endTime.after($latestEndTime)})
#set($latestEndTime = ${endTime})
#set($key = ${watch.action} + ${watch.etn} + ${watch.startTime} + ${watch.endTime})
#if (${list.contains(${keys}, $key)})
#set($value = ${mymap.get($key)})
#else
#set($value = [])
#set($success = $keys.add($key))
#end
#set($success = $value.add($watch))
#set($success = ${mymap.put($key,$value)})
#end
#end
#end
#if(!${list.isEmpty($severeWatches)})
A SEVERE THUNDERSTORM WATCH REMAINS IN EFFECT UNTIL ${dateUtil.format(${latestEndTime}, ${timeFormat.plain}, 15, ${localtimezone})}##
${dateUtil.period(${latestEndTime},${timeFormat.plain}, 15, ${localtimezone})}##
#set($svrWatchAlso = "")
#foreach(${key} in ${keys})
#set($severeWatches = ${mymap.get($key)})
#set($svrWatch = ${severeWatches.get(0)})
A SEVERE THUNDERSTORM WATCH ${svrWatchAlso}REMAINS IN EFFECT UNTIL ${dateUtil.format(${svrWatch.endTime}, ${timeFormat.plain}, 15, ${localtimezone})}##
${dateUtil.period(${svrWatch.endTime},${timeFormat.plain}, 15, ${localtimezone})}##
#if(${secondtimezone})
/${dateUtil.format(${watch.getEndTime()}, ${timeFormat.plain}, 15, ${secondtimezone})}/##
#end
@ -254,11 +270,13 @@ ${dateUtil.period(${latestEndTime},${timeFormat.plain}, 15, ${localtimezone})}##
...##
#end
#end
#set($svrWatchAlso = "ALSO ")
. ##
#end
#end
########END MACRO
########END
#macro(printcoords $coordinates $list)
#set($count = 0)

View file

@ -330,13 +330,13 @@ runJmap() {
fi
local cmd="/awips2/java/bin/jmap -dump:format=b,file=${dumpPath}"
echo "${t1}: Running command: $cmd $options $pid >> $log 2>&1 &" >> $processFile
$cmd $options $pid >> $log 2>&1 &
echo "${t1}: Running command: $cmd $options $pid >> $log 2>&1" >> $processFile
$cmd $options $pid >> $log 2>&1
if [[ "$?" != "0" && $FORCE != "y" ]]; then
t1=`date "+%Y%m%d %H:%M:%S"`
echo "${t1}: jmap for $pid failed to connect, rerunning with -F" >> $processFile
$cmd $options -F $pid >> $log 2>&1 &
$cmd $options -F $pid >> $log 2>&1
fi
}

View file

@ -0,0 +1,180 @@
#!/bin/sh
#####################################################################
# 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.
#####################################################################
#####################################################################
# Script for capturing data from a wrapper java process when the
# wrapper restarts the process
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------- -------- ----------- --------------------------
# Aug 07, 2014 3470 rjpeter Initial creation
#
#####################################################################
# NOTE: Script must be located at /awips2/qpid/bin/yajsw/scripts for it to work
# base path to save capture data to, will create subdirectory for each server
basePath="/data/fxa/cave"
state=$1
string_state=$2
pid=$4
path_to_script=`readlink -f $0`
curTime=`date +%Y%m%d_%H%M%S`
echo "$curTime: Wrapper running $path_to_script due to state transition for pid $pid. New State $state|$string_state"
# ensure directory is created and has write permissions
checkDir() {
dir="$1"
if [ ! -d "$dir" ]; then
mkdir -p $dir
if [ ! -d "$dir" ]; then
message="Unable to create qpid capture data directory\n$dir"
echo -e "Capture failed: $message"
exit 1
fi
fi
if [ ! -w "$dir" ]; then
message="Do not have write permissions to qpid capture data directory\n$dir"
echo -e "Capture failed: $message"
exit 1
fi
}
# gets top output of local server
runTop() {
local curTime=`date "+%Y%m%d_%H:%M:%S"`
echo "$curTime: Capturing top"
echo "$curTime: Capturing top" >> $processFile
local out_file="${dataPath}/top.log"
export COLUMNS=160
top -b -c -n1 >> $out_file 2>&1
curTime=`date +%Y%m%d_%H%M%S`
echo "$curTime: top captured"
}
# runs jstack 10 times, if it fails will run again with -F
runJstack() {
local curTime=`date +%Y%m%d_%H%M%S`
echo "$curTime: Capturing jstacks"
local pid="$1"
local count=1
local cmd="/awips2/java/bin/jstack"
local prePath="${dataPath}/pid_${pid}_"
local log=""
while [ "$count" -le "10" ]; do
curTime=`date "+%Y%m%d_%H:%M:%S"`
log="${prePath}jstack_${count}.log"
echo "${curTime}: Running command: ${cmd} ${pid} >> ${log} 2>&1" >> $processFile
echo "Running for $curTime" >> $log
${cmd} ${pid} >> ${log} 2>&1
if [[ "$?" != "0" && $FORCE != "y" ]]; then
curTime=`date "+%Y%m%d_%H:%M:%S"`
echo "${curTime}: jstack for $pid failed to connect, rerunning with -F" >> $processFile
${cmd} -F ${pid} >> ${log} 2>&1
fi
let "count+=1"
done
curTime=`date +%Y%m%d_%H%M%S`
echo "$curTime: jstacks captured"
}
# runs jmap -heap
runJmapHeap() {
local curTime=`date +%Y%m%d_%H%M%S`
echo "$curTime: Capturing jmap -heap"
local pid=$1
local prePath="${dataPath}/pid_${pid}_"
local log="${prePath}jmapHeap.log"
local cmd="/awips2/java/bin/jmap -heap"
echo "${curTime}: Running command: $cmd $pid >> $log 2>&1" >> $processFile
$cmd $pid >> $log 2>&1
if [[ "$?" != "0" && $FORCE != "y" ]]; then
curTime=`date "+%Y%m%d_%H:%M:%S"`
echo "${curTime}: jmap for $pid failed to connect, rerunning with -F" >> $processFile
$cmd -F $pid >> $log 2>&1
fi
curTime=`date +%Y%m%d_%H%M%S`
echo "$curTime: jmap -heap captured"
}
# runs jmap, if it fails will run again with -F
runJmap() {
local curTime=`date +%Y%m%d_%H%M%S`
echo "$curTime: Capturing jmap -dump"
local pid=$1
local prePath="${dataPath}/pid_${pid}_jmap"
local log="${prePath}.log"
local dumpPath="${prePath}.hprof"
local cmd="/awips2/java/bin/jmap -dump:format=b,file=${dumpPath}"
echo "${curTime}: Running command: $cmd $pid >> $log 2>&1" >> $processFile
$cmd $pid >> $log 2>&1
if [[ "$?" != "0" && $FORCE != "y" ]]; then
curTime=`date "+%Y%m%d_%H:%M:%S"`
echo "${curTime}: jmap for $pid failed to connect, rerunning with -F" >> $processFile
$cmd -F $pid >> $log 2>&1
fi
curTime=`date +%Y%m%d_%H%M%S`
echo "$curTime: jmap -dump captured"
}
if [[ "$pid" != "-1" ]]; then
process=`ps -ef | grep $pid | grep java`
if [[ "$process" != "" ]]; then
hostName=`hostname -s`
dataPath="${basePath}/${hostName}/wrapperCaptureData_${curTime}_pid_$pid"
checkDir $dataPath
processFile=${dataPath}/capture_info.log
echo "Wrapper running $0 due to state transition for pid $pid. New State $state|$string_state" >> $processFile
echo "Process information:" >> $processFile
ps -ef | grep $pid >> $processFile
runTop &
runJstack $pid &
runJmapHeap $pid &
# TODO: Double check if jvm already dumped one
runJmap $pid &
wait
curTime=`date +%Y%m%d_%H%M%S`
echo "$curTime: Data captured to $dataPath"
else
curTime=`date +%Y%m%d_%H%M%S`
echo "$curTime: PID $pid is no longer running, nothing to capture"
fi
else
curTime=`date +%Y%m%d_%H%M%S`
echo "$curTime: PID was -1, process no longer running, nothing to capture"
fi

View file

@ -3,6 +3,10 @@
determine where the various destination directories are
without ant-contrib
-->
<!-- the location of javaUtilities -->
<dirname property="jutilities.dir" file="${basedir}" />
<!-- the EDEX destination -->
<available file="${basedir}/../build.edex"
property="edex.destination"
@ -73,6 +77,14 @@
<exclude name="**/ReadMe.txt" />
</fileset>
</copy>
<!-- copy scripts -->
<mkdir dir="${edex.bin.directory}/yajsw/scripts" />
<copy todir="${edex.bin.directory}/yajsw/scripts"
failonerror="true" verbose="true" overwrite="true">
<fileset dir="${jutilities.dir}/yajsw-scripts">
<include name="*.sh" />
</fileset>
</copy>
<!-- deploy to QPID -->
<tar destfile="${qpid.destination}/SOURCES/yajsw-distribution.tar"
basedir="${edex.bin.directory}"

View file

@ -5,3 +5,5 @@ yajsw/src/main/java/org/rzo/yajsw/os/posix/bsd/AppStarter.java
yajsw/src/main/java/org/rzo/yajsw/os/posix/bsd/BSDProcess.java
yajsw/src/main/java/org/rzo/yajsw/wrapper/AbstractWrappedProcess.java
yajsw/src/main/java/org/rzo/yajsw/wrapper/WrappedJavaProcess.java
yajsw/src/main/java/org/rzo/yajsw/script/AbstractScript.java
yajsw/src/main/java/org/rzo/yajsw/script/ShellScript.java

View file

@ -16,6 +16,7 @@ import java.util.concurrent.Future;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.jboss.netty.util.HashedWheelTimer;
import org.jboss.netty.util.Timeout;
@ -28,29 +29,27 @@ import org.rzo.yajsw.wrapper.WrappedProcess;
/**
* The Class AbstractScript.
*/
public abstract class AbstractScript implements Script
{
public abstract class AbstractScript implements Script {
/** The _name. */
String _name;
String _name;
/** The _timeout. */
int _timeout = 30000;
int _timeout = 30000;
WrappedProcess _process;
WrappedProcess _process;
String _id;
String _id;
String[] _args;
String[] _args;
final static Timer TIMER = new HashedWheelTimer();
static final ExecutorService EXECUTOR = (ThreadPoolExecutor) new ThreadPoolExecutor(0, 50, 120L, TimeUnit.SECONDS,
new SynchronousQueue<Runnable>(), new DaemonThreadFactory("scriptExecutorInternal"));
static final ExecutorService EXECUTOR = (ThreadPoolExecutor) new ThreadPoolExecutor(
0, 50, 120L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(),
new DaemonThreadFactory("scriptExecutorInternal"));
volatile Future _future;
volatile Timeout _timerTimeout;
/**
* Instantiates a new abstract script.
*
@ -58,8 +57,8 @@ public abstract class AbstractScript implements Script
* the script
* @param timeout
*/
public AbstractScript(String script, String id, WrappedProcess process, String[] args, int timeout)
{
public AbstractScript(String script, String id, WrappedProcess process,
String[] args, int timeout) {
_name = script;
_process = process;
_id = id;
@ -76,41 +75,35 @@ public abstract class AbstractScript implements Script
* java.lang.String, java.lang.Object)
*/
public abstract Object execute(String line);
public abstract void interrupt();
abstract void log(String msg);
synchronized public void executeWithTimeout(final String line)
{
Object result = null;
_timerTimeout = TIMER.newTimeout(new TimerTask()
{
public void run(Timeout arg0) throws Exception
{
log("script takes too long -> interrupt");
try
{
interrupt();
}
catch (Throwable e)
{
}
synchronized public void executeWithTimeout(final String line) {
/**
* Changed by rjpeter Aug 07, 2014.
*/
_future = EXECUTOR.submit(new Callable<Object>() {
@Override
public Object call() {
return execute(line);
}
});
// wait for script to finish
try {
_future.get(_timeout, TimeUnit.MILLISECONDS);
} catch (TimeoutException e) {
log("script " + _name + " took too long -> interrupt");
try {
interrupt();
} catch (Throwable e1) {
}
} catch (Exception e) {
}
, _timeout, TimeUnit.MILLISECONDS);
_future = EXECUTOR.submit(new Callable<Object>()
{
public Object call()
{
Object result = execute(line);
if (_timerTimeout != null)
_timerTimeout.cancel();
_timerTimeout = null;
return result;
}
});
}
/*
@ -118,8 +111,7 @@ public abstract class AbstractScript implements Script
*
* @see org.rzo.yajsw.script.Script#getScript()
*/
public String getScript()
{
public String getScript() {
return _name;
}
@ -128,8 +120,7 @@ public abstract class AbstractScript implements Script
*
* @return the timeout
*/
public int getTimeout()
{
public int getTimeout() {
return _timeout;
}
@ -139,8 +130,7 @@ public abstract class AbstractScript implements Script
* @param timeout
* the new timeout
*/
public void setTimeout(int timeout)
{
public void setTimeout(int timeout) {
_timeout = timeout;
}

View file

@ -76,8 +76,10 @@ public class ShellScript extends AbstractScript
public void executeWithTimeout()
{
// TODO Auto-generated method stub
/*
* Updated by bkowal 08/06/2014
*/
this.executeWithTimeout("");
}
@Override

View file

@ -6,6 +6,9 @@
/*
* ldm server mainline program module
*
* Updated on: Aug 05, 2014 (Omaha #3458: Increased edexBridge queue size to 10000)
* Author: rjpeter
*/
#include <ldmconfig.h>
@ -251,7 +254,7 @@ main(int ac, char *av[])
prod_class_t clss;
int toffset = TOFFSET_NONE;
int loggingToStdErr = 0;
unsigned queue_size = 5000;
unsigned queue_size = 10000;
conffilename = DEFAULT_CONFFILENAME;

View file

@ -7,6 +7,8 @@
* Author: bkowal
* Updated on: May 06, 2014 (Issue #3102: Updated to call cleanup if connect failed. Limit number of messages to be sent to QPID on a single send call)
* Author: rjpeter
* Updated on: Aug 05, 2014 (Omaha #3458: Added logging of error when issue occurs on send)
* Author: rjpeter
*/
#include <qpid/messaging/Connection.h>
@ -116,6 +118,7 @@ public:
}
} catch (const std::exception& error) {
// Error occurred during communication. Clean up the connection and return the number of messages processed.
uerror(error.what());
cleanup();
}

View file

@ -9,7 +9,7 @@
Name: awips2-ldm
Summary: AWIPS II LDM Distribution
Version: %{_ldm_version}
Release: 13
Release: %{_component_version}.%{_component_release}
Group: AWIPSII
BuildRoot: /tmp
BuildArch: noarch

View file

@ -70,7 +70,14 @@ wrapper.java.additional.7=-Dqpid.broker.exceptionHandler.continue=true
# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=1536
wrapper.ping.timeout=300
wrapper.ping.interval=5
wrapper.ping.timeout=30
# NOTE: script must be located at /awips2/qpid/bin/yajsw/scripts for it to be found
wrapper.script.ABORT=wrapperCapture.sh
wrapper.script.ABORT.timeout=120
wrapper.script.RESTART=wrapperCapture.sh
wrapper.script.RESTART.timeout=120
#********************************************************************
# Monitor the Application

View file

@ -14,7 +14,7 @@ diff -crB a/qpid-java.spec b/qpid-java.spec
!
! Name: awips2-qpid-java
Version: 0.18
! Release: 4%{?dist}
! Release: 5%{?dist}
Summary: Java implementation of Apache Qpid
License: Apache Software License
Group: Development/Java