You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by bu...@apache.org on 2015/07/17 23:19:07 UTC

svn commit: r1691644 - /uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccSchedulerClasses.java

Author: burn
Date: Fri Jul 17 21:19:07 2015
New Revision: 1691644

URL: http://svn.apache.org/r1691644
Log:
UIMA-4519 Make DuccSchedulerClasses thread-safe

Modified:
    uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccSchedulerClasses.java

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccSchedulerClasses.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccSchedulerClasses.java?rev=1691644&r1=1691643&r2=1691644&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccSchedulerClasses.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccSchedulerClasses.java Fri Jul 17 21:19:07 2015
@@ -59,10 +59,12 @@ public class DuccSchedulerClasses {
      * Pass in a logger, usefull in the daemons.  If no logger the NodeConfiguration will
      * write to stdout/stderr.
      */
+	
+	/* Not used?  And should call this() instead of super()
 	public DuccSchedulerClasses(DuccLogger logger) {
         super();
         this.logger = logger;
-	}
+	}*/
 	
 	public String getProperty(Properties properties, String name) {
         if ( properties == null ) return null;
@@ -82,10 +84,11 @@ public class DuccSchedulerClasses {
 
         File file = new File(fileName);
         if ( lastModified != file.lastModified() ) {         // reread if it looks like it changed
-            lastModified = file.lastModified();
-            nodeConfiguration = new NodeConfiguration(fileName, null, null, logger); // UIMA-4275 use single common constructor
-            lastModified = file.lastModified();
-            nodeConfiguration.readConfiguration();
+            synchronized(this) {    // Ensure parallel threads see a valid nodeConfiguration 
+                nodeConfiguration = new NodeConfiguration(fileName, null, null, logger); // UIMA-4275 use single common constructor
+                nodeConfiguration.readConfiguration();
+                lastModified = file.lastModified();   // Update this AFTER the nodeConfiguration is valid
+            }
         }
 
 		return nodeConfiguration;