LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  October 2015

HPS-SVN October 2015

Subject:

r3898 - in /java/trunk: evio/src/main/java/org/hps/evio/EvioToLcio.java job/src/main/java/org/hps/job/JobManager.java monitoring-app/src/main/java/org/hps/monitoring/application/EventProcessing.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Wed, 28 Oct 2015 02:02:05 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (189 lines)

Author: [log in to unmask]
Date: Tue Oct 27 19:02:02 2015
New Revision: 3898

Log:
[HPSJAVA-626] Rearrange some conditions initialization to un-break monitoring app.

Modified:
    java/trunk/evio/src/main/java/org/hps/evio/EvioToLcio.java
    java/trunk/job/src/main/java/org/hps/job/JobManager.java
    java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventProcessing.java

Modified: java/trunk/evio/src/main/java/org/hps/evio/EvioToLcio.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/EvioToLcio.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/EvioToLcio.java	Tue Oct 27 19:02:02 2015
@@ -24,7 +24,6 @@
 import org.apache.commons.cli.PosixParser;
 import org.freehep.record.source.NoSuchRecordException;
 import org.hps.conditions.database.DatabaseConditionsManager;
-import org.hps.detector.svt.SvtDetectorSetup;
 import org.hps.job.JobManager;
 import org.hps.logging.config.DefaultLoggingConfig;
 import org.hps.record.LCSimEventBuilder;
@@ -454,9 +453,6 @@
      */
     public void run() {
 
-        // Register class for setting up SVT detector state from conditions data.
-        DatabaseConditionsManager.getInstance().addConditionsListener(new SvtDetectorSetup());
-
         // Is there a run number from the command line options?
         if (runNumber != null) {
             // Initialize the conditions system before the job starts and freeze it.

Modified: java/trunk/job/src/main/java/org/hps/job/JobManager.java
 =============================================================================
--- java/trunk/job/src/main/java/org/hps/job/JobManager.java	(original)
+++ java/trunk/job/src/main/java/org/hps/job/JobManager.java	Tue Oct 27 19:02:02 2015
@@ -30,14 +30,6 @@
      * Class constructor.
      */
     public JobManager() {
-
-        try {
-            // Since this is packaged with the distribution, the class is not directly accessible.
-            final Object hpsJavaProperties = Class.forName("org.hps.HPSJavaProperties").newInstance();
-            logger.info(hpsJavaProperties.toString());
-        } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
-            // Just don't print info if not accessible (running in test case?).
-        }
     }
 
     /**
@@ -47,10 +39,13 @@
      */
     public void setup(InputStream is) {
         
-        // Always want to reset the conditions system before initialization.
-        DatabaseConditionsManager.resetInstance();
-
+        // Add class that will setup SVT detector with conditions data (this is awkward but has to be done someplace).
+        DatabaseConditionsManager.getInstance().addConditionsListener(new SvtDetectorSetup());
+        
         super.setup(is);
+                
+        // Setup the conditions system if there is a ConditionsDriver present.
+        this.setupConditions();        
     }
     
     /**
@@ -61,12 +56,6 @@
     @Override
     public final boolean run() {
         
-        // Add class that will setup SVT detector with conditions data (this is awkward but has to be done someplace).
-        DatabaseConditionsManager.getInstance().addConditionsListener(new SvtDetectorSetup());
-
-        // Setup the conditions system if there is a ConditionsDriver present.
-        this.setupConditions();
-
         // Run the job.
         final boolean result = super.run();
 

Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventProcessing.java
 =============================================================================
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventProcessing.java	(original)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventProcessing.java	Tue Oct 27 19:02:02 2015
@@ -33,7 +33,6 @@
 import org.jlab.coda.et.exception.EtClosedException;
 import org.jlab.coda.et.exception.EtException;
 import org.lcsim.conditions.ConditionsListener;
-import org.lcsim.conditions.ConditionsManager;
 import org.lcsim.conditions.ConditionsReader;
 import org.lcsim.util.Driver;
 
@@ -192,6 +191,11 @@
      * The current {@link EventProcessing.SessionState} object which has all of the session state for event processing.
      */
     private SessionState sessionState;
+   
+    /**
+     * The current conditions manager.
+     */ 
+    private DatabaseConditionsManager conditionsManager;
 
     /**
      * Class constructor, which will initialize with reference to the current monitoring application and lists of extra
@@ -315,7 +319,7 @@
         }
 
         // Add the builder as a listener so it is notified when conditions change.
-        ConditionsManager.defaultInstance().addConditionsListener(this.sessionState.eventBuilder);
+        this.conditionsManager.addConditionsListener(this.sessionState.eventBuilder);
     }
 
     /**
@@ -409,12 +413,12 @@
      * Notify the loop to pause the event processing.
      */
     synchronized void pause() {
-        this.logger.finest("pausing");
         if (!this.connectionModel.getPaused()) {
+            this.logger.finest("pausing");
             this.sessionState.loop.pause();
             this.connectionModel.setPaused(true);
-        }
-        this.logger.finest("paused");
+            this.logger.finest("paused");
+        }
     }
 
     /**
@@ -435,7 +439,7 @@
      *
      * @param configurationModel the global @link org.hps.monitoring.model.ConfigurationModel} object
      */
-    void setup(final ConfigurationModel configurationModel) {
+    synchronized void setup(final ConfigurationModel configurationModel) {
 
         // Setup LCSim from the configuration.
         this.setupLcsim(configurationModel);
@@ -468,11 +472,13 @@
             // Create the job manager. A new conditions manager is instantiated from this call but not configured.
             this.sessionState.jobManager = new JobManager();
 
+            // Set ref to current conditions manager.
+            this.conditionsManager = DatabaseConditionsManager.getInstance();
+            
             // Add conditions listeners after new database conditions manager is initialized from the job manager.
-            final DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
             for (final ConditionsListener conditionsListener : this.sessionState.conditionsListeners) {
                 this.logger.config("adding conditions listener " + conditionsListener.getClass().getName());
-                conditionsManager.addConditionsListener(conditionsListener);
+                this.conditionsManager.addConditionsListener(conditionsListener);
             }
 
             if (configurationModel.hasValidProperty(ConfigurationModel.DETECTOR_ALIAS_PROPERTY)) {
@@ -507,15 +513,15 @@
                 final int userRunNumber = configurationModel.getUserRunNumber();
                 final String detectorName = configurationModel.getDetectorName();
                 this.logger.config("setting user run number " + userRunNumber + " with detector " + detectorName);
-                conditionsManager.setDetector(configurationModel.getDetectorName(), userRunNumber);
+                conditionsManager.setDetector(detectorName, userRunNumber);
                 if (configurationModel.hasPropertyKey(ConfigurationModel.FREEZE_CONDITIONS_PROPERTY)) {
                     // Freeze the conditions system to ignore run numbers from the events.
                     this.logger.config("user configured to freeze conditions system");
-                    conditionsManager.freeze();
+                    this.conditionsManager.freeze();
                 } else {
                     // Allow run numbers to be picked up from the events.
                     this.logger.config("user run number provided but conditions system is NOT frozen");
-                    conditionsManager.unfreeze();
+                    this.conditionsManager.unfreeze();
                 }
             }
 
@@ -545,8 +551,7 @@
                 .setEtConnection(this.sessionState.connection).setFilePath(configurationModel.getDataSourcePath())
                 .setLCSimEventBuilder(this.sessionState.eventBuilder);
 
-        this.logger.config("data source path is " + configurationModel.getDataSourcePath());
-        this.logger.config("data source type is " + configurationModel.getDataSourceType());
+        this.logger.config("data src path " + configurationModel.getDataSourcePath() + " and type " + configurationModel.getDataSourceType());
 
         // Set the max events.
         if (configurationModel.hasValidProperty(ConfigurationModel.MAX_EVENTS_PROPERTY)) {

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use