diff --git a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/ScanStarterJob.java b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/ScanStarterJob.java index 9201d1f1f7..196c8d9f1b 100644 --- a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/ScanStarterJob.java +++ b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/ScanStarterJob.java @@ -26,6 +26,7 @@ import org.eclipse.core.runtime.jobs.Job; import org.eclipse.swt.widgets.Shell; 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.viz.core.VizApp; @@ -76,6 +77,8 @@ public class ScanStarterJob extends Job { scan.setup(icao); } + SCANConfig.getInstance(); + VizApp.runAsync(new Runnable() { @Override diff --git a/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/scan/config/AbsConfigMgr.java b/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/scan/config/AbsConfigMgr.java index d6248b5eba..dca0972fde 100644 --- a/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/scan/config/AbsConfigMgr.java +++ b/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/scan/config/AbsConfigMgr.java @@ -23,8 +23,12 @@ import java.awt.Point; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; +import java.util.Map; 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.monitor.data.CommonTableConfig.SortDirection; 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 * ------------ ---------- ----------- -------------------------- * Oct 21, 2009 3039 lvenable Initial creation + * Apr 25, 2013 1926 njensen Improved initialization speed * * * @@ -52,12 +57,12 @@ public abstract class AbsConfigMgr { /** * Map of attribute names and SCANAttributesXML. */ - HashMap attrMap; + protected Map attrMap; /** * Map of attribute names and column index. */ - HashMap indexMap; + protected Map indexMap; /** * Default XML name. @@ -76,7 +81,6 @@ public abstract class AbsConfigMgr { indexMap = new HashMap(); init(); - createAttributeMap(getAttributes()); } /** @@ -109,12 +113,16 @@ public abstract class AbsConfigMgr { SCANAbstractXML cfgXML = null; IPathManager pm = PathManagerFactory.getPathManager(); - String path = pm.getStaticFile(getFullDefaultConfigName()) - .getAbsolutePath(); - - cfgXML = (SCANAbstractXML) SerializationUtil - .jaxbUnmarshalFromXmlFile(path.toString()); - + LocalizationFile lfile = pm.getLocalizationFile(pm.getContext( + LocalizationType.CAVE_STATIC, LocalizationLevel.SITE), + getFullDefaultConfigName()); + if (lfile == null || !lfile.exists()) { + lfile = pm.getLocalizationFile(pm.getContext( + LocalizationType.CAVE_STATIC, LocalizationLevel.BASE), + getFullDefaultConfigName()); + } + cfgXML = SerializationUtil.jaxbUnmarshalFromXmlFile( + SCANAbstractXML.class, lfile.getFile()); return cfgXML; } catch (Exception e) { e.printStackTrace(); @@ -142,8 +150,8 @@ public abstract class AbsConfigMgr { IPathManager pm = PathManagerFactory.getPathManager(); String path = pm.getStaticFile(newConfigFile).getAbsolutePath(); - cfgXML = (SCANAbstractXML) SerializationUtil - .jaxbUnmarshalFromXmlFile(path.toString()); + cfgXML = SerializationUtil.jaxbUnmarshalFromXmlFile( + SCANAbstractXML.class, path.toString()); return cfgXML; } catch (Exception e) { diff --git a/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/scan/config/SCANConfig.java b/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/scan/config/SCANConfig.java index 8d223950f3..d149a7dc8a 100644 --- a/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/scan/config/SCANConfig.java +++ b/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/scan/config/SCANConfig.java @@ -50,6 +50,7 @@ import com.raytheon.uf.common.monitor.scan.xml.SCANAttributesXML; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Oct 25, 2009 3039 lvenable Initial creation + * Apr 25, 2013 1926 njensen synchronized instance creation * * * @@ -60,7 +61,7 @@ public class SCANConfig { /** * Class instance */ - private static SCANConfig classInstance; + private static volatile SCANConfig classInstance; /** * Unwarned configuration data class. @@ -242,11 +243,18 @@ public class SCANConfig { * @return Class instance. */ public static SCANConfig getInstance() { - if (classInstance == null) { - classInstance = new SCANConfig(); + SCANConfig retVal = classInstance; + 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"); dmdTrendConfigMgr = new TrendSetConfigMgr("DmdTrendSets.xml"); - ; setupTableIntFormatMap(); setupTrendIntFormatMaps();