You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by ch...@apache.org on 2013/03/14 14:10:51 UTC

svn commit: r1456413 - in /uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm: ServiceHandler.java ServiceSet.java

Author: challngr
Date: Thu Mar 14 13:10:51 2013
New Revision: 1456413

URL: http://svn.apache.org/r1456413
Log:
UIMA-2739
Remember to reset failure count once something works, or if autostart is set back on.

Modified:
    uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceHandler.java
    uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceSet.java

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceHandler.java?rev=1456413&r1=1456412&r2=1456413&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceHandler.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceHandler.java Thu Mar 14 13:10:51 2013
@@ -643,7 +643,12 @@ public class ServiceHandler
             sset.establish(id, w.getJobState());
 
             // State is established.  Now, if the instance died, remove it - OR will keep publishing it for a while and we want to ignore those
-            if ( ! w.isActive() ) {
+            if (  w.isActive() ) {
+                // Hard to know for sure, if there are a bunch of instances, some working and some not, how to manage this.
+                // But this is a state *change* of something, and the something is active, so probably the service is OK now
+                // if it hadn't been before.
+                sset.resetRunFailures();
+            } else {
                 sset.removeImplementor(id);
 
                 JobCompletionType jct = w.getCompletionType();
@@ -658,7 +663,7 @@ public class ServiceHandler
                     default:
                         logger.debug(methodName, id, "RECORDING FAILURE");
                         // all other cases are errors that contribute to the error count
-                        if ( sset.runFailures() ) {    // if true, the count is exceeeded, but reset
+                        if ( sset.excessiveRunFailures() ) {    // if true, the count is exceeeded, but reset
                             logger.warn(methodName, null, "Process Failure: " + jct + " Maximum consecutive failures[" + sset.failure_run + "] max [" + sset.failure_max + "]");
                         }
                         break;

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceSet.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceSet.java?rev=1456413&r1=1456412&r2=1456413&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceSet.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceSet.java Thu Mar 14 13:10:51 2013
@@ -616,6 +616,11 @@ public class ServiceSet
         meta_props.setProperty("autostart", auto ? "true" : "false");
         this.autostart = auto;
         saveMetaProperties();
+        if ( auto ) {
+            // turning this on gives benefit of the doubt on failure management
+            failure_start = 0;
+            failure_run = 0;
+        }
     }
 
     synchronized void persistImplementors()
@@ -979,7 +984,12 @@ public class ServiceSet
         return key;
     }
 
-    synchronized boolean runFailures()
+    void resetRunFailures()
+    {
+        failure_run = 0;
+    }
+
+    synchronized boolean excessiveRunFailures()
     {
         String methodName = "runFailures";
         if ( (++failure_run) > failure_max ) {