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 2016/05/12 13:13:36 UTC

svn commit: r1743497 - /uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/NodeConfiguration.java

Author: burn
Date: Thu May 12 13:13:36 2016
New Revision: 1743497

URL: http://svn.apache.org/viewvc?rev=1743497&view=rev
Log:
UIMA-4930 Check for only one policy per priority

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

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/NodeConfiguration.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/NodeConfiguration.java?rev=1743497&r1=1743496&r2=1743497&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/NodeConfiguration.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/NodeConfiguration.java Thu May 12 13:13:36 2016
@@ -916,6 +916,24 @@ public class NodeConfiguration
             } 
         }
     }
+    
+    // UIMA-4930 Enforce the NodepoolScheduler restriction that classes with the same priority MUST have the same scheduling policy
+    void checkPriorities() throws IllegalConfigurationException {
+      HashMap<String, String> policyMap = new HashMap<String,String>();
+      for ( DuccProperties p : classes ) {
+        String priority = p.getProperty("priority");
+        String policy = p.getProperty("policy");  
+        String p4p = policyMap.get(priority);
+        if (p4p == null) {
+          policyMap.put(priority,  policy);
+        } else {
+          if (!p4p.equals(policy)) {
+            throw new IllegalConfigurationException("Class " + p.getProperty("name") + " has the same priority (" + priority +
+                    ") as another but with a different scheduling policy (" + policy + ")");
+          }
+        }
+      }
+    }
 
     /**
      * Make sure any classes specified in the user registry exist and specify a number.
@@ -1107,6 +1125,7 @@ public class NodeConfiguration
             connectNodepools();
             readNpNodes(defaultDomain);
             checkForCycles();
+            checkPriorities();
         } finally {
             if ( in != null ) {
                 try { in.close();