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 2014/02/06 21:51:30 UTC

svn commit: r1565434 - /uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/plugin/AbstractJdProcessExceptionHandler.java

Author: degenaro
Date: Thu Feb  6 20:51:29 2014
New Revision: 1565434

URL: http://svn.apache.org/r1565434
Log:
UIMA-3601 DUCC Job Driver (JD) should automatically retry work items encountering "Wire format negotiation timeout" exceptions

Modified:
    uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/plugin/AbstractJdProcessExceptionHandler.java

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/plugin/AbstractJdProcessExceptionHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/plugin/AbstractJdProcessExceptionHandler.java?rev=1565434&r1=1565433&r2=1565434&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/plugin/AbstractJdProcessExceptionHandler.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/plugin/AbstractJdProcessExceptionHandler.java Thu Feb  6 20:51:29 2014
@@ -81,7 +81,18 @@ public abstract class AbstractJdProcessE
 		return s1.equals(s2);
 	}
 	
-	private enum AnalysisOfCause {
+	protected boolean contains(String s1, String s2) {
+		if(s1 == null) {
+			return false;
+		}
+		if(s2 == null) {
+			return false;
+		}
+		return s1.contains(s2);
+	}
+	
+	protected enum AnalysisOfCause {
+		WireFormatTimeout,
 		RemoteTimeout,
 		LocalTimeout,
 		Other
@@ -94,8 +105,17 @@ public abstract class AbstractJdProcessE
 			int level = 0;
 			while( nextCause != null ) {
 				String sCause = nextCause.toString();
+				String sMessage = nextCause.getLocalizedMessage();
 				record(sCause);
-				if(isEqual(sCause,"org.apache.uima.aae.error.UimaASProcessCasTimeout")) {
+				if(contains(sCause,"Wire format negotiation timeout")) {
+					retVal = AnalysisOfCause.WireFormatTimeout;
+					break;
+				}
+				else if(contains(sMessage,"Wire format negotiation timeout")) {
+					retVal = AnalysisOfCause.WireFormatTimeout;
+					break;
+				}
+				else if(isEqual(sCause,"org.apache.uima.aae.error.UimaASProcessCasTimeout")) {
 					if(level > 0) {
 						retVal = AnalysisOfCause.RemoteTimeout;
 					}
@@ -104,6 +124,7 @@ public abstract class AbstractJdProcessE
 					}
 					break;
         		}
+				
         		nextCause = nextCause.getCause();
         		level++;
 			}
@@ -123,14 +144,36 @@ public abstract class AbstractJdProcessE
 		return retVal;
 	}
 	
+	protected boolean isTransportIssue(AnalysisOfCause analysisOfCause) {
+		boolean retVal = false;
+		if(analysisOfCause != null) {
+			switch(analysisOfCause) {
+			case WireFormatTimeout:
+				retVal = true;
+				break;
+			}
+		}
+		return retVal;
+	}
+	
 	protected Directive handleRetry(String processId, CAS cas, Throwable t, Properties properties) {
 		Directive directive = null;
+		String casId = (String) properties.get(JdProperties.SequenceNumber);
 		AnalysisOfCause analysisOfCause = getAnalysisOfCause(t);
-		if(isLocalTimeout(analysisOfCause)) {
+		if(isTransportIssue(analysisOfCause)) {
+			directive = Directive.ProcessContinue_CasRetry;
+			directive.setReason("WireFormatTimeout");
+			// record to log
+			StringBuffer message = new StringBuffer();
+			message.append("directive="+directive);
+			message.append(", ");
+			message.append("["+casId+"]");
+			record(message);
+		}
+		else if(isLocalTimeout(analysisOfCause)) {
 			// if the maximum number of CAS timeouts is exceeded
 			//   then do not retry CAS
 			AtomicInteger casTimeoutCounter;
-			String casId = (String) properties.get(JdProperties.SequenceNumber);
 			synchronized(mapCasTimeoutCounts) {
 				if(!mapCasTimeoutCounts.containsKey(casId)) {
 					casTimeoutCounter = new AtomicInteger(0);