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  January 2015

HPS-SVN January 2015

Subject:

r1982 - /java/trunk/conditions/src/main/java/org/hps/conditions/database/DatabaseConditionsManager.java

From:

[log in to unmask]

Reply-To:

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

Date:

Sat, 24 Jan 2015 02:37:02 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (121 lines)

Author: [log in to unmask]
Date: Fri Jan 23 18:36:55 2015
New Revision: 1982

Log:
Changed comments and other minor updates.

Modified:
    java/trunk/conditions/src/main/java/org/hps/conditions/database/DatabaseConditionsManager.java

Modified: java/trunk/conditions/src/main/java/org/hps/conditions/database/DatabaseConditionsManager.java
 =============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/database/DatabaseConditionsManager.java	(original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/database/DatabaseConditionsManager.java	Fri Jan 23 18:36:55 2015
@@ -115,8 +115,8 @@
     protected boolean cacheAllConditions = false;
     protected boolean isTestRun = false;
     
-    // Default login timeout of 5 seconds.
     static {
+        // Default login timeout of 5 seconds.
         DriverManager.setLoginTimeout(5);
     }
     
@@ -174,7 +174,7 @@
             }
             
             if (!loggedConnectionParameters) {
-                // Print out detailed info to the log on first connection.
+                // Print out detailed info to the log on first connection within the job.
                 logger.info("opening connection to " + connectionParameters.getConnectionString());
                 logger.info("host " + connectionParameters.getHostname());
                 logger.info("port " + connectionParameters.getPort());
@@ -327,7 +327,10 @@
             } else if (runNumber > TEST_RUN_MAX_RUN) {
                 // Run numbers greater than max of Test Run assumed to be Eng Run (for now!).
                 setXmlConfig(DatabaseConditionsManager.ENGRUN_CONFIG);
-            } 
+            } else if (runNumber == 0) {
+                // Use the default configuration because the run number is basically meaningless.
+                setXmlConfig(DatabaseConditionsManager.DEFAULT_CONFIG);
+            }
         }
 
         registerConverters();
@@ -338,7 +341,7 @@
         // Open the database connection.
         openConnection();
         
-        // Call the super class's setDetector method to construct the detector object.
+        // Call the super class's setDetector method to construct the detector object and activate listeners.
         super.setDetector(detectorName, runNumber);
                         
         // Should all conditions sets be cached?
@@ -366,7 +369,7 @@
     }
 
     /**
-     * 
+     * Register the conditions converters with the manager.
      */
     private void registerConverters() {
         if (svtConverter != null) {
@@ -701,7 +704,11 @@
         TableMetaData tableMetaData = collection.getTableMetaData();
         if (tableMetaData == null) {            
             tableMetaData = tableRegistry.findByCollectionType(collection.getClass()); 
-            logger.fine("using default table meta data with table " + tableMetaData.getTableName() + " for collection of type " + collection.getClass().getCanonicalName());            
+            if (tableMetaData == null) {
+                // This is a fatal error because no meta data is available for the type.
+                throw new ConditionsObjectException("Failed to find meta data for type: " + collection.getClass());
+            }
+            logger.fine("using default table meta data " + tableMetaData.getTableName() + " for type " + collection.getClass());            
         }
         if (collection.getCollectionId() == -1) {
             try {
@@ -710,14 +717,12 @@
                 throw new RuntimeException(e);
             }
         }
+        // FIXME: If collection ID is already set this should be an error!
+        
         logger.info("inserting collection with ID " + collection.getCollectionId() 
                 + " and key " + tableMetaData.getKey() + " into table " + tableMetaData.getTableName());
 
-        boolean openedConnection = false;
-        if (!isConnected()) {
-            openConnection();
-            openedConnection = true;
-        }
+        boolean openedConnection = openConnection();
         
         PreparedStatement preparedStatement = null;
         
@@ -756,7 +761,7 @@
         } catch (Exception e) {
         }
                
-        closeConnection(openedConnection);        
+        closeConnection(openedConnection);
     }
     
     /**
@@ -845,6 +850,7 @@
             } 
         } catch (UnknownHostException e) {
             // This will actually print a warning if the JLAB server is unreachable.
+            // There is always a warning when running outside JLAB, so suppress it for now.
             //logger.log(Level.WARNING, e.getMessage(), e);
         } catch (IOException e) {
             logger.severe(e.getMessage());
@@ -881,7 +887,7 @@
     
     /**
      * Setup the database connection from a file specified by a Java system
-     * property setting. This is possibly overridden by subsequent, direct API calls to
+     * property setting. This could be overridden by subsequent API calls to
      * {@link #setConnectionProperties(File)} or {@link #setConnectionResource(String)}.
      */
     private void setupConnectionFromSystemProperty() {

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