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

HPS-SVN March 2015

Subject:

r2455 - /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, 14 Mar 2015 23:32:57 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (96 lines)

Author: [log in to unmask]
Date: Sat Mar 14 16:32:54 2015
New Revision: 2455

Log:
Mark several key methods as synchronized to improve thread safety.

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	Sat Mar 14 16:32:54 2015
@@ -139,7 +139,7 @@
      * Get the static instance of this class.
      * @return The static instance of the manager.
      */
-    public static DatabaseConditionsManager getInstance() {
+    public synchronized static DatabaseConditionsManager getInstance() {
 
         logger.finer("getting conditions manager instance");
         
@@ -177,7 +177,7 @@
      * Open the database connection.
      * @return True if a connection was opened; false if using an existing connection.
      */
-    public boolean openConnection() {
+    public synchronized boolean openConnection() {
         boolean openedConnection = false;
         if (!isConnected) {
             // Do the connection parameters need to be figured out automatically?
@@ -211,7 +211,7 @@
     /**
      * Close the database connection.
      */
-    public void closeConnection() {
+    public synchronized void closeConnection() {
         logger.fine("closing connection");
         if (connection != null) {
             try {
@@ -232,7 +232,7 @@
      * based on the flag.  Otherwise, it should be left open.
      * @param connectionOpened True to close the connection; false to leave it open.
      */
-    public void closeConnection(boolean connectionOpened) {
+    public synchronized void closeConnection(boolean connectionOpened) {
         if (connectionOpened) {
             closeConnection();
         }
@@ -269,7 +269,7 @@
      * needs to be updated.
      */
     @Override
-    public void setDetector(String detectorName, int runNumber) throws ConditionsNotFoundException {
+    public synchronized void setDetector(String detectorName, int runNumber) throws ConditionsNotFoundException {
 
         logger.finest("setDetector " + detectorName + " with run number " + runNumber);
         
@@ -371,7 +371,7 @@
      * @param tableName The name of the table.
      * @return The next collection ID.
      */
-    public int getNextCollectionID(String tableName) {
+    public synchronized int getNextCollectionID(String tableName) {
         boolean openedConnection = openConnection();
         ResultSet resultSet = selectQuery("SELECT MAX(collection_id)+1 FROM " + tableName);
         int collectionId = 1;
@@ -537,7 +537,7 @@
      * This method can be called to "freeze" the conditions system so that
      * any subsequent updates to run number or detector name will be ignored.
      */
-    public void freeze() {
+    public synchronized void freeze() {
         if (getDetector() != null && getRun() != -1) {
             isFrozen = true;
             logger.config("conditions system is frozen");
@@ -549,7 +549,7 @@
     /**
      * Un-freeze the conditions system so that updates will be received again.
      */
-    public void unfreeze() {
+    public synchronized void unfreeze() {
         isFrozen = false;
         logger.info("conditions system unfrozen");
     }
@@ -750,7 +750,7 @@
      * configuration and loading of conditions onto the Detector.
      */
     private void initialize(String detectorName, int runNumber) throws ConditionsNotFoundException {
-        
+                
         logger.config("initializing with detector " + detectorName + " and run " + runNumber);
         
         // Is not configured yet?

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