Merge "Issue #2627 harden static initialization on edex main thread" into development
Former-commit-id:fdba3b3099
[formerly7c02ab6b66
] [formerlyfdba3b3099
[formerly7c02ab6b66
] [formerly6b08aaf55c
[formerly 82f20a96a82ef7f047f716662d319e522ee1c394]]] Former-commit-id:6b08aaf55c
Former-commit-id:f6e1fc89de
[formerlyc12b4fb4ea
] Former-commit-id:0041d4c2d3
This commit is contained in:
commit
ec31c46b9a
1 changed files with 24 additions and 12 deletions
|
@ -51,6 +51,7 @@ import com.raytheon.uf.edex.core.props.PropertiesFactory;
|
||||||
* Feb 05, 2013 1580 mpduff EventBus refactor.
|
* Feb 05, 2013 1580 mpduff EventBus refactor.
|
||||||
* Feb 12, 2013 1615 bgonzale Changed ProcessEvent pluginName to dataType.
|
* Feb 12, 2013 1615 bgonzale Changed ProcessEvent pluginName to dataType.
|
||||||
* Jan 21, 2014 2627 njensen Added logFailedData() and logFailureAsInfo()
|
* Jan 21, 2014 2627 njensen Added logFailedData() and logFailureAsInfo()
|
||||||
|
* Mar 04, 2014 2627 njensen Harden static initialization
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -79,19 +80,30 @@ public class ProcessUtil {
|
||||||
protected static final boolean RETAIN_FAILED_DATA;
|
protected static final boolean RETAIN_FAILED_DATA;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// this will probably only ever be true on a testbed
|
boolean retain = false;
|
||||||
RETAIN_FAILED_DATA = Boolean.getBoolean("retain.failed.data");
|
String dir = null;
|
||||||
if (RETAIN_FAILED_DATA) {
|
try {
|
||||||
FAILED_DIR = PropertiesFactory.getInstance().getEnvProperties()
|
/*
|
||||||
.getEnvValue("DEFAULTDATADIR")
|
* this will probably only ever be true on a testbed because sites
|
||||||
+ File.separator + "failed";
|
* typically keep multiple days of raw data
|
||||||
File file = new File(FAILED_DIR);
|
*/
|
||||||
if (!file.exists()) {
|
retain = Boolean.getBoolean("retain.failed.data");
|
||||||
file.mkdir();
|
if (retain) {
|
||||||
|
dir = PropertiesFactory.getInstance().getEnvProperties()
|
||||||
|
.getEnvValue("DEFAULTDATADIR")
|
||||||
|
+ File.separator + "failed";
|
||||||
|
File file = new File(dir);
|
||||||
|
if (!file.exists()) {
|
||||||
|
file.mkdirs();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} catch (Throwable t) {
|
||||||
FAILED_DIR = null;
|
dir = null;
|
||||||
|
retain = false;
|
||||||
|
handler.error("Error validating retain.failed.data settings", t);
|
||||||
}
|
}
|
||||||
|
FAILED_DIR = dir;
|
||||||
|
RETAIN_FAILED_DATA = retain;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -235,7 +247,7 @@ public class ProcessUtil {
|
||||||
String fullpath = getHeaderProperty(headers, ("ingestFileName"));
|
String fullpath = getHeaderProperty(headers, ("ingestFileName"));
|
||||||
handler.error("Failed to ingest " + fullpath, e);
|
handler.error("Failed to ingest " + fullpath, e);
|
||||||
|
|
||||||
if (RETAIN_FAILED_DATA) {
|
if (RETAIN_FAILED_DATA && FAILED_DIR != null) {
|
||||||
File badfile = new File(fullpath);
|
File badfile = new File(fullpath);
|
||||||
if (badfile.exists()) {
|
if (badfile.exists()) {
|
||||||
String filename = badfile.getName();
|
String filename = badfile.getName();
|
||||||
|
|
Loading…
Add table
Reference in a new issue