You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by de...@apache.org on 2016/05/03 21:57:14 UTC

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

Author: degenaro
Date: Tue May  3 19:57:13 2016
New Revision: 1742188

URL: http://svn.apache.org/viewvc?rev=1742188&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=1742188&r1=1742187&r2=1742188&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 Tue May  3 19:57:13 2016
@@ -891,6 +891,7 @@ public class ServiceSet
     	String location = "determinePingerStatus";
     	switch(getState()) {
     	case Available:
+    	case Waiting:
     		if(serviceMeta == null) {
     			notPinging = true;
     			notPingingReason = "pinger has not reported";
@@ -1536,7 +1537,7 @@ public class ServiceSet
         return service_state;
     }
 
-    synchronized void setState(ServiceState new_state, ServiceState cumulative, ServiceInstance si)
+    synchronized void setState(ServiceState req_new_state, ServiceState req_cumulative, ServiceInstance si)
     {
         String methodName = "setState";
 
@@ -1548,6 +1549,38 @@ 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:
+        		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 + "]" );