Print

Print


Author: [log in to unmask]
Date: Wed Mar 25 15:15:47 2015
New Revision: 2559

Log:
Add synchronized key word to improve thread safety of this class.

Modified:
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/daqconfig/ConfigurationManager.java

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/daqconfig/ConfigurationManager.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/daqconfig/ConfigurationManager.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/daqconfig/ConfigurationManager.java	Wed Mar 25 15:15:47 2015
@@ -34,7 +34,7 @@
      * @return Returns the DAQ settings as a <code>DAQConfig</code>
      * object or <code>null</code>.
      */
-    public static final DAQConfig getInstance() {
+    public synchronized static final DAQConfig getInstance() {
         if(INITIALIZED) { return DAQ_CONFIG; }
         else { return null; }
     }
@@ -43,7 +43,7 @@
      * Adds a listener to track when updates occur in the DAQ settings.
      * @param listener - The listener.
      */
-    public static final void addActionListener(ActionListener listener) {
+    public synchronized static final void addActionListener(ActionListener listener) {
         if(listener != null) { AL_LIST.add(listener); }
     }
     
@@ -72,7 +72,7 @@
      * when the DAQ configuration changes.
      * @param listener - The listener to remove.
      */
-    public static final void removeActionListener(ActionListener listener) {
+    public synchronized static final void removeActionListener(ActionListener listener) {
         if(listener != null) { AL_LIST.remove(listener); }
     }
     
@@ -82,7 +82,7 @@
      * associated listeners that an update has occurred.
      * @param parser - The updated DAQ information.
      */
-    public static final void updateConfiguration(EvioDAQParser parser) {
+    public synchronized static final void updateConfiguration(EvioDAQParser parser) {
         INITIALIZED = false;
         DAQ_CONFIG.loadConfig(parser);
         INITIALIZED = true;