Author: challngr Date: Mon Aug 25 18:49:01 2014 New Revision: 1620410 URL: http://svn.apache.org/r1620410 Log: UIMA-3988 SM Update query and minor adjustments to referenced / autostart flags.
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 uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/sm/ServiceDescription.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=1620410&r1=1620409&r2=1620410&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 Mon Aug 25 18:49:01 2014 @@ -861,7 +861,11 @@ public class ServiceHandler // CLI/API prevents instances < -1 if ( instances == -1 ) { // figure out n to lose - sset.disableAndStop("Disabled by stop from id " + event.getUser()); + if ( sset.isAutostart() || sset.isReferencedStart() ) { + sset.disableAndStop("Disabled by stop from id " + event.getUser()); + } else { + sset.stop(running); + } } else { tolose = Math.min(instances, running); sset.updateInstances(Math.max(0, running - tolose)); // pass in target intances running 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=1620410&r1=1620409&r2=1620410&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 Mon Aug 25 18:49:01 2014 @@ -217,6 +217,8 @@ public class ServiceSet parseIndependentServices(); meta_props.remove("references"); // Will get refreshred in upcoming OR state messages + meta_props.remove("stopped"); // obsolete flag, clean out of older registrations + meta_props.put("service-class", ""+service_class.decode()); meta_props.put("service-type", ""+service_type.decode()); meta_props.put("enabled", "" + enabled); // may not have been there in the first place @@ -501,6 +503,12 @@ public class ServiceSet meta_props.setProperty(history_key, sb.toString().trim()); } } + + // on restart, if we think we were ref started when we crashed, but there are no + // implementors, we can't actually be ref started, so clean that up. + if ( isReferencedStart() && (countImplementors() == 0 ) ) { + this.reference_start = false; + } saveMetaProperties(); } @@ -806,6 +814,9 @@ public class ServiceSet } + meta_props.put("reference", isReferencedStart() ? "true" : "false"); + meta_props.put("autostart", isAutostart() ? "true" : "false"); + meta_props.put("enabled", ""+enabled); meta_props.put("service-state", ""+ getState()); meta_props.put("ping-active", "" + (serviceMeta != null)); Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/sm/ServiceDescription.java URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/sm/ServiceDescription.java?rev=1620410&r1=1620409&r2=1620410&view=diff ============================================================================== --- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/sm/ServiceDescription.java (original) +++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/sm/ServiceDescription.java Mon Aug 25 18:49:01 2014 @@ -395,7 +395,13 @@ public class ServiceDescription sb.append(" Start Mode : "); if ( autostart ) { sb.append("autostart"); } else if ( reference_start ) { sb.append("reference"); } - else { sb.append("manual"); } + else { + if ( references.size() > 0 ) { + sb.append("manual"); + } else { + sb.append("stopped"); + } + } if ( enabled ) { sb.append(", Enabled"); @@ -414,7 +420,7 @@ public class ServiceDescription sb.append("\n"); if ( error_string != null ) { - sb.append(" Errors : "); + sb.append(" Errors : "); sb.append(error_string); sb.append("\n"); }