Issue #1926 faster first time startup
Change-Id: Iddd1667d262204932b4f76b8e6c44e09cfc53ccc Former-commit-id:e076551190
[formerly84e0f09de3
] [formerly31b05de2d1
] [formerly51ebd8007a
[formerly31b05de2d1
[formerly a184bc9a967754e2e12be73da7a1e16c02490432]]] Former-commit-id:51ebd8007a
Former-commit-id: 31ffccc17c9fd1fd6031925bb198c74fca29986d [formerlyd059b1d524
] Former-commit-id:450dd42dda
This commit is contained in:
parent
a149d7eb2f
commit
094f968d1d
3 changed files with 34 additions and 16 deletions
|
@ -26,6 +26,7 @@ import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.monitor.scan.config.SCANConfig;
|
||||||
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
|
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
|
||||||
import com.raytheon.uf.viz.core.VizApp;
|
import com.raytheon.uf.viz.core.VizApp;
|
||||||
|
|
||||||
|
@ -76,6 +77,8 @@ public class ScanStarterJob extends Job {
|
||||||
scan.setup(icao);
|
scan.setup(icao);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SCANConfig.getInstance();
|
||||||
|
|
||||||
VizApp.runAsync(new Runnable() {
|
VizApp.runAsync(new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -23,8 +23,12 @@ import java.awt.Point;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.raytheon.uf.common.localization.IPathManager;
|
import com.raytheon.uf.common.localization.IPathManager;
|
||||||
|
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||||
|
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||||
|
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||||
import com.raytheon.uf.common.monitor.data.CommonTableConfig.SortDirection;
|
import com.raytheon.uf.common.monitor.data.CommonTableConfig.SortDirection;
|
||||||
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanThresholdColor;
|
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanThresholdColor;
|
||||||
|
@ -42,6 +46,7 @@ import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Oct 21, 2009 3039 lvenable Initial creation
|
* Oct 21, 2009 3039 lvenable Initial creation
|
||||||
|
* Apr 25, 2013 1926 njensen Improved initialization speed
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -52,12 +57,12 @@ public abstract class AbsConfigMgr {
|
||||||
/**
|
/**
|
||||||
* Map of attribute names and SCANAttributesXML.
|
* Map of attribute names and SCANAttributesXML.
|
||||||
*/
|
*/
|
||||||
HashMap<String, SCANAttributesXML> attrMap;
|
protected Map<String, SCANAttributesXML> attrMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map of attribute names and column index.
|
* Map of attribute names and column index.
|
||||||
*/
|
*/
|
||||||
HashMap<String, Integer> indexMap;
|
protected Map<String, Integer> indexMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default XML name.
|
* Default XML name.
|
||||||
|
@ -76,7 +81,6 @@ public abstract class AbsConfigMgr {
|
||||||
indexMap = new HashMap<String, Integer>();
|
indexMap = new HashMap<String, Integer>();
|
||||||
|
|
||||||
init();
|
init();
|
||||||
createAttributeMap(getAttributes());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,12 +113,16 @@ public abstract class AbsConfigMgr {
|
||||||
SCANAbstractXML cfgXML = null;
|
SCANAbstractXML cfgXML = null;
|
||||||
|
|
||||||
IPathManager pm = PathManagerFactory.getPathManager();
|
IPathManager pm = PathManagerFactory.getPathManager();
|
||||||
String path = pm.getStaticFile(getFullDefaultConfigName())
|
LocalizationFile lfile = pm.getLocalizationFile(pm.getContext(
|
||||||
.getAbsolutePath();
|
LocalizationType.CAVE_STATIC, LocalizationLevel.SITE),
|
||||||
|
getFullDefaultConfigName());
|
||||||
cfgXML = (SCANAbstractXML) SerializationUtil
|
if (lfile == null || !lfile.exists()) {
|
||||||
.jaxbUnmarshalFromXmlFile(path.toString());
|
lfile = pm.getLocalizationFile(pm.getContext(
|
||||||
|
LocalizationType.CAVE_STATIC, LocalizationLevel.BASE),
|
||||||
|
getFullDefaultConfigName());
|
||||||
|
}
|
||||||
|
cfgXML = SerializationUtil.jaxbUnmarshalFromXmlFile(
|
||||||
|
SCANAbstractXML.class, lfile.getFile());
|
||||||
return cfgXML;
|
return cfgXML;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -142,8 +150,8 @@ public abstract class AbsConfigMgr {
|
||||||
IPathManager pm = PathManagerFactory.getPathManager();
|
IPathManager pm = PathManagerFactory.getPathManager();
|
||||||
String path = pm.getStaticFile(newConfigFile).getAbsolutePath();
|
String path = pm.getStaticFile(newConfigFile).getAbsolutePath();
|
||||||
|
|
||||||
cfgXML = (SCANAbstractXML) SerializationUtil
|
cfgXML = SerializationUtil.jaxbUnmarshalFromXmlFile(
|
||||||
.jaxbUnmarshalFromXmlFile(path.toString());
|
SCANAbstractXML.class, path.toString());
|
||||||
|
|
||||||
return cfgXML;
|
return cfgXML;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -50,6 +50,7 @@ import com.raytheon.uf.common.monitor.scan.xml.SCANAttributesXML;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Oct 25, 2009 3039 lvenable Initial creation
|
* Oct 25, 2009 3039 lvenable Initial creation
|
||||||
|
* Apr 25, 2013 1926 njensen synchronized instance creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -60,7 +61,7 @@ public class SCANConfig {
|
||||||
/**
|
/**
|
||||||
* Class instance
|
* Class instance
|
||||||
*/
|
*/
|
||||||
private static SCANConfig classInstance;
|
private static volatile SCANConfig classInstance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unwarned configuration data class.
|
* Unwarned configuration data class.
|
||||||
|
@ -242,11 +243,18 @@ public class SCANConfig {
|
||||||
* @return Class instance.
|
* @return Class instance.
|
||||||
*/
|
*/
|
||||||
public static SCANConfig getInstance() {
|
public static SCANConfig getInstance() {
|
||||||
if (classInstance == null) {
|
SCANConfig retVal = classInstance;
|
||||||
classInstance = new SCANConfig();
|
if (retVal == null) {
|
||||||
|
synchronized (SCANConfig.class) {
|
||||||
|
retVal = classInstance;
|
||||||
|
if (retVal == null) {
|
||||||
|
classInstance = new SCANConfig();
|
||||||
|
retVal = classInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return classInstance;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -261,7 +269,6 @@ public class SCANConfig {
|
||||||
|
|
||||||
cellTrendConfigMgr = new TrendSetConfigMgr("CellTrendSets.xml");
|
cellTrendConfigMgr = new TrendSetConfigMgr("CellTrendSets.xml");
|
||||||
dmdTrendConfigMgr = new TrendSetConfigMgr("DmdTrendSets.xml");
|
dmdTrendConfigMgr = new TrendSetConfigMgr("DmdTrendSets.xml");
|
||||||
;
|
|
||||||
|
|
||||||
setupTableIntFormatMap();
|
setupTableIntFormatMap();
|
||||||
setupTrendIntFormatMaps();
|
setupTrendIntFormatMaps();
|
||||||
|
|
Loading…
Add table
Reference in a new issue