You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2020/06/10 13:14:58 UTC

[uima-async-scaleout] 14/34: UIMA-5501

This is an automated email from the ASF dual-hosted git repository.

cwiklik pushed a commit to branch uima-as-3
in repository https://gitbox.apache.org/repos/asf/uima-async-scaleout.git

commit 1647d08d6da515a6b9666118b57fae42fa83325e
Author: cwiklik <cwiklik>
AuthorDate: Mon May 7 21:33:16 2018 +0000

    UIMA-5501
---
 .../java/org/apache/uima/aae/error/Thresholds.java   | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/uimaj-as-core/src/main/java/org/apache/uima/aae/error/Thresholds.java b/uimaj-as-core/src/main/java/org/apache/uima/aae/error/Thresholds.java
index 2b63f8c..0a8cffa 100644
--- a/uimaj-as-core/src/main/java/org/apache/uima/aae/error/Thresholds.java
+++ b/uimaj-as-core/src/main/java/org/apache/uima/aae/error/Thresholds.java
@@ -8,7 +8,20 @@ import org.apache.uima.resourceSpecifier.GetMetadataErrorsType;
 import org.apache.uima.resourceSpecifier.ProcessCasErrorsType;
 
 public class Thresholds {
+	public enum Action { TERMINATE, CONTINUE, DISABLE};
+	
+ 	public static Threshold newThreshold(Action action) {
+		Threshold t = new Threshold();
+		t.setAction(action.name().toLowerCase());
+		t.setContinueOnRetryFailure(false);
+		t.setMaxRetries(0);
+		t.setThreshold(1);
+		t.setWindow(0);
+		return t;
+	}
   	public static Threshold newThreshold() {
+  		return newThreshold(Action.TERMINATE);
+  		/*
 		Threshold t = new Threshold();
 		t.setAction("terminate");
 		t.setContinueOnRetryFailure(false);
@@ -16,6 +29,7 @@ public class Thresholds {
 		t.setThreshold(1);
 		t.setWindow(0);
 		return t;
+*/
 	}
 	public static Threshold getThreshold(String action, int maxRetries ) {
 		Threshold t1 = newThreshold();
@@ -64,7 +78,7 @@ public class Thresholds {
 				delegate.setGetMetaTimeout(errorHandler.getTimeout());
 				thresholdMap.put(delegate.getKey(), t);
 			} else {
-				thresholdMap.put(delegate.getKey(), newThreshold());
+				thresholdMap.put(delegate.getKey(), newThreshold(Action.TERMINATE));
 			}
 		}
 		public static void addDelegateErrorThreshold(AnalysisEngineDelegate delegate, ProcessCasErrorsType errorHandler, Map<String, Threshold> thresholdMap) {
@@ -73,7 +87,7 @@ public class Thresholds {
 				delegate.setProcessTimeout(errorHandler.getTimeout());
 				thresholdMap.put(delegate.getKey(), t);
 			} else {
-				thresholdMap.put(delegate.getKey(), newThreshold());
+				thresholdMap.put(delegate.getKey(), newThreshold(Action.TERMINATE));
 			}
 		}
 		public static void addDelegateErrorThreshold(AnalysisEngineDelegate delegate, CollectionProcessCompleteErrorsType  errorHandler, Map<String, Threshold> thresholdMap) {
@@ -82,7 +96,7 @@ public class Thresholds {
 				delegate.setProcessTimeout(errorHandler.getTimeout());
 				thresholdMap.put(delegate.getKey(), t);
 			} else {
-				thresholdMap.put(delegate.getKey(), newThreshold());
+				thresholdMap.put(delegate.getKey(), newThreshold(Action.CONTINUE));
 			}
 		}