Author: degenaro
Date: Thu May  5 20:07:58 2016
New Revision: 1742469

URL: http://svn.apache.org/viewvc?rev=1742469&view=rev
Log:
UIMA-4829 When a DUCC pinger hangs is it reported as Available

Modified:
    
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/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=1742469&r1=1742468&r2=1742469&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 May  5 20:07:58 2016
@@ -882,6 +882,7 @@ public class ServiceSet
        }
        
        /**
+        * UIMA-4829
         * If the Service state is Available but the pinger data has not been 
updated
         * beyond the expiry time then determine that the pinger data is stale
         * 
@@ -891,7 +892,6 @@ public class ServiceSet
        String location = "determinePingerStatus";
        switch(getState()) {
        case Available:
-       case Waiting:
                if(serviceMeta == null) {
                        notPinging = true;
                        notPingingReason = "pinger has not reported";
@@ -916,14 +916,7 @@ public class ServiceSet
                        notPingingReason = "N/A";
                break;
        }
-       if(notPinging) {
-               logger.info(location, id, notPingingReason);
-               switch(service_state) {
-               case Available:
-                       logger.info(location, id, service_state+" => 
"+ServiceState.Waiting);
-                       service_state = ServiceState.Waiting;
-               }
-       }
+       logger.trace(location, id, "pinging: "+!notPinging+" "+"reason: 
"+notPingingReason);
        return;
     }
     
@@ -1530,8 +1523,17 @@ public class ServiceSet
         if ( serviceMeta == null ) {
             response = (response.ordinality() < 
ServiceState.Waiting.ordinality()) ? response : ServiceState.Waiting;
         } else if ( serviceMeta != null ) {
-            logger.trace(methodName, id, "Cumulative before checking 
monitor/pinger:", response, ".  Monitor state:", serviceMeta.getServiceState());
-            if ( serviceMeta.getServiceState().ordinality() <= 
response.ordinality() ) response = serviceMeta.getServiceState();
+               // UIMA-4829
+               // If the pinger is not pinging), then force cumulative state 
to Waiting.
+               determinePingerStatus();
+               if(notPinging) {
+                       logger.trace(methodName, id, "Not pinging. "+" State 
override from:"+response, " to:"+ServiceState.Waiting);
+                       response = ServiceState.Waiting;
+               }
+               else {
+                       logger.trace(methodName, id, "Cumulative before 
checking monitor/pinger:", response, ".  Monitor state:", 
serviceMeta.getServiceState());
+                if ( serviceMeta.getServiceState().ordinality() <= 
response.ordinality() ) response = serviceMeta.getServiceState();
+               }
         }
 
         return response;
@@ -1542,7 +1544,7 @@ public class ServiceSet
         return service_state;
     }
 
-    synchronized void setState(ServiceState req_new_state, ServiceState 
req_cumulative, ServiceInstance si)
+    synchronized void setState(ServiceState new_state, ServiceState 
cumulative, ServiceInstance si)
     {
         String methodName = "setState";
 
@@ -1554,39 +1556,6 @@ public class ServiceSet
         }
 
         ServiceState prev = this.service_state;
-        ServiceState new_state = req_new_state;
-        ServiceState cumulative = req_cumulative;
-        
-        /**
-         * If pinger is stale and state is Available then force state to be 
Waiting
-         */
-        determinePingerStatus();
-        if(notPinging) {
-               switch(new_state) {
-               case Available:
-               case Waiting:   
-                       new_state = ServiceState.Waiting;
-                       cumulative = new_state;
-                       logger.debug(methodName, id, "NotPinging[1]: 
"+req_new_state+" => "+new_state+"; "+req_cumulative+" => "+cumulative);
-                       break;
-               default:
-                       switch(cumulative) {
-                       case Available:
-                               new_state = ServiceState.Waiting;
-                       cumulative = new_state;
-                       logger.debug(methodName, id, "NotPinging[2]: 
"+req_new_state+" => "+new_state+"; "+req_cumulative+" => "+cumulative);
-                               break;
-                       default:
-                               logger.debug(methodName, id, "NotPinging[3]: 
"+req_new_state+" => "+new_state+"; "+req_cumulative+" => "+cumulative);
-                               break;
-                       }
-                       break;
-               }
-        }
-        else {
-               logger.debug(methodName, id, "Pinging: "+req_new_state+" => 
"+new_state+"; "+req_cumulative+" => "+cumulative);
-        }
-        
         this.service_state = new_state;
         if ( prev != new_state ) {
             logger.info(methodName, id, "State update from[" + prev + "] to[" 
+ new_state + "] via[" + cumulative + "] Inst[" + tail + "]" );


Reply via email to