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/11/08 16:19:09 UTC

svn commit: r1637572 - in /uima/sandbox/uima-ducc/trunk: uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/cas/ uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ uima-ducc-container/src/test/java/org/apach...

Author: degenaro
Date: Sat Nov  8 15:19:08 2014
New Revision: 1637572

URL: http://svn.apache.org/r1637572
Log:
UIMA-4069 Redesign of JD toward the main goal of classpath separation for container (system) code.

ProxyJobDriverErrorHandler and ProxyJobDriverCollectionReader with test cases.  IJdUserErrorHandler change CAS to String type.

Added:
    uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ProxyJobDriverCollectionReader.java
      - copied, changed from r1637477, uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/JobDriverCollectionReader.java
    uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/user/jd/test/helper/TestJdContainerErrorHandler.java   (with props)
    uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/helper/TestJdUserErrorHandler.java   (with props)
Removed:
    uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/JobDriverCollectionReader.java
Modified:
    uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/cas/CasManager.java
    uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ProxyJobDriverErrorHandler.java
    uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestClassLoading.java
    uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestSuite.java
    uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/iface/IJdUserErrorHandler.java
    uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/iface/JdUserErrorHandler.java
    uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/TestSuite.java

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/cas/CasManager.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/cas/CasManager.java?rev=1637572&r1=1637571&r2=1637572&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/cas/CasManager.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/cas/CasManager.java Sat Nov  8 15:19:08 2014
@@ -26,14 +26,14 @@ import org.apache.uima.ducc.container.co
 import org.apache.uima.ducc.container.common.IEntityId;
 import org.apache.uima.ducc.container.jd.JobDriverException;
 import org.apache.uima.ducc.container.jd.cas.CasManagerStats.RetryReason;
-import org.apache.uima.ducc.container.jd.classload.JobDriverCollectionReader;
+import org.apache.uima.ducc.container.jd.classload.ProxyJobDriverCollectionReader;
 import org.apache.uima.ducc.container.net.iface.IMetaCas;
 
 public class CasManager {
 
 	private IContainerLogger logger = ContainerLogger.getLogger(CasManager.class, IContainerLogger.Component.JD.name());
 	
-	private JobDriverCollectionReader jdcr = null;
+	private ProxyJobDriverCollectionReader pjdcr = null;
 	
 	private LinkedBlockingQueue<IMetaCas> cacheQueue = new LinkedBlockingQueue<IMetaCas>();
 	
@@ -52,8 +52,8 @@ public class CasManager {
 				classLoaderUrls[i] = this.getClass().getResource(item);
 				i++;
 			}
-			jdcr = new JobDriverCollectionReader(classLoaderUrls, crXml, crCfg);
-			casManagerStats.setCrTotal(jdcr.getTotal());
+			pjdcr = new ProxyJobDriverCollectionReader(classLoaderUrls, crXml, crCfg);
+			casManagerStats.setCrTotal(pjdcr.getTotal());
 		}
 		catch(JobDriverException e) {
 			logger.error(location, IEntityId.null_id, e);
@@ -67,7 +67,7 @@ public class CasManager {
 			casManagerStats.incRetryQueueGets();
 		}
 		else {
-			retVal = jdcr.getMetaCas();
+			retVal = pjdcr.getMetaCas();
 			if(retVal != null) {
 				casManagerStats.incCrGets();
 			}

Copied: uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ProxyJobDriverCollectionReader.java (from r1637477, uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/JobDriverCollectionReader.java)
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ProxyJobDriverCollectionReader.java?p2=uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ProxyJobDriverCollectionReader.java&p1=uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/JobDriverCollectionReader.java&r1=1637477&r2=1637572&rev=1637572&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/JobDriverCollectionReader.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ProxyJobDriverCollectionReader.java Sat Nov  8 15:19:08 2014
@@ -19,24 +19,25 @@
 package org.apache.uima.ducc.container.jd.classload;
 
 import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.lang.reflect.Type;
 import java.net.URL;
 import java.net.URLClassLoader;
 
 import org.apache.uima.ducc.container.common.ContainerLogger;
-import org.apache.uima.ducc.container.common.IEntityId;
 import org.apache.uima.ducc.container.common.IContainerLogger;
+import org.apache.uima.ducc.container.common.IEntityId;
 import org.apache.uima.ducc.container.common.MessageBuffer;
 import org.apache.uima.ducc.container.common.Standardize;
 import org.apache.uima.ducc.container.jd.JobDriverException;
 import org.apache.uima.ducc.container.net.impl.MetaCas;
 
-public class JobDriverCollectionReader {
+public class ProxyJobDriverCollectionReader {
 
-	private IContainerLogger logger = ContainerLogger.getLogger(JobDriverCollectionReader.class, IContainerLogger.Component.JD.name());
+	private IContainerLogger logger = ContainerLogger.getLogger(ProxyJobDriverCollectionReader.class, IContainerLogger.Component.JD.name());
 	
 	private URLClassLoader urlClassLoader = null;
+	
 	private String crXml = null;
 	private String crCfg = null;
 	
@@ -58,6 +59,8 @@ public class JobDriverCollectionReader {
 	private String name_getDocumentText = "getDocumentText";
 	private String name_getSerializedCas = "getSerializedCas";
 	
+	private Method method_deserialize = null;
+	
 	private String[] requiredClasses = { 
 			"org.apache.uima.ducc.user.jd.JdUserCollectionReader", 
 			"org.apache.uima.aae.UimaSerializer",
@@ -65,63 +68,64 @@ public class JobDriverCollectionReader {
 			"com.thoughtworks.xstream.XStream",
 			};
 	
-	public JobDriverCollectionReader(URLClassLoader classLoader, String crXml, String cfCfg) throws JobDriverException {
+	public ProxyJobDriverCollectionReader(URLClassLoader classLoader, String crXml, String cfCfg) throws JobDriverException {
 		construct(classLoader, crXml, cfCfg);
 	}
 	
-	public JobDriverCollectionReader(URL[] classLoaderUrls, String crXml, String cfCfg) throws JobDriverException {
+	public ProxyJobDriverCollectionReader(URL[] classLoaderUrls, String crXml, String cfCfg) throws JobDriverException {
 		URLClassLoader classLoader = new URLClassLoader(classLoaderUrls, ClassLoader.getSystemClassLoader().getParent());
 		construct(classLoader, crXml, cfCfg);
 	}
 	
 	public int getTotal() throws JobDriverException {
+		String location = "getTotal";
 		int retVal = -1;
 		try {
 			retVal = (Integer)method_getTotal.invoke(instance_JdUserCollectionReader, nullObjectArray);
-		} catch (IllegalAccessException e) {
-			JobDriverException jobDriverException = new JobDriverException(e);
-			throw jobDriverException;
-		} catch (IllegalArgumentException e) {
-			JobDriverException jobDriverException = new JobDriverException(e);
-			throw jobDriverException;
-		} catch (InvocationTargetException e) {
-			JobDriverException jobDriverException = new JobDriverException(e);
-			throw jobDriverException;
+		} 
+		catch (Exception e) {
+			logger.error(location, IEntityId.null_id, e);
+			throw new JobDriverException(e);
 		}
 		return retVal;
 	}
 	
 	public MetaCas getMetaCas() throws JobDriverException {
+		String location = "getMetaCas";
 		MetaCas retVal = null;
 		try {
 			method_getJdUserMetaCas = class_JdUserCollectionReader.getMethod(name_getJdUserMetaCas, nullClassArray);
 			Object instance_metaCas = method_getJdUserMetaCas.invoke(instance_JdUserCollectionReader, nullObjectArray);
 			if(instance_metaCas != null) {
 				Method method_getSeqNo = class_JdUserMetaCas.getMethod(name_getSeqNo, nullClassArray);
-				Integer x = (Integer)method_getSeqNo.invoke(instance_metaCas, nullObjectArray);
-				int seqNo = x.intValue();
+				Integer integer = (Integer)method_getSeqNo.invoke(instance_metaCas, nullObjectArray);
+				int seqNo = integer.intValue();
 				Method method_getSerializedCas = class_JdUserMetaCas.getMethod(name_getSerializedCas, nullClassArray);
 				Object serializedCas = method_getSerializedCas.invoke(instance_metaCas, nullObjectArray);
 				Method method_getDocumentText = class_JdUserMetaCas.getMethod(name_getDocumentText, nullClassArray);
 				String docId = (String)method_getDocumentText.invoke(instance_metaCas, nullObjectArray);
 				retVal = new MetaCas(seqNo, docId, serializedCas);
 			}
-		} catch (NoSuchMethodException e) {
-			JobDriverException jobDriverException = new JobDriverException(e);
-			throw jobDriverException;
-		} catch (SecurityException e) {
-			JobDriverException jobDriverException = new JobDriverException(e);
-			throw jobDriverException;
-		} catch (IllegalAccessException e) {
-			JobDriverException jobDriverException = new JobDriverException(e);
-			throw jobDriverException;
-		} catch (IllegalArgumentException e) {
-			JobDriverException jobDriverException = new JobDriverException(e);
-			throw jobDriverException;
-		} catch (InvocationTargetException e) {
-			JobDriverException jobDriverException = new JobDriverException(e);
-			throw jobDriverException;
-		}	
+		} 
+		catch (Exception e) {
+			logger.error(location, IEntityId.null_id, e);
+			throw new JobDriverException(e);
+		}
+		return retVal;
+	}
+	
+	public Object deserialize(String serializedCas) throws JobDriverException {
+		String location = "deserialize";
+		Object retVal = null;
+		try {
+			Object[] parms = new Object[1];
+			parms[0] = serializedCas;
+			retVal = method_deserialize.invoke(instance_JdUserCollectionReader, parms);
+		} 
+		catch (Exception e) {
+			logger.error(location, IEntityId.null_id, e);
+			throw new JobDriverException(e);
+		}
 		return retVal;
 	}
 	
@@ -132,12 +136,17 @@ public class JobDriverCollectionReader {
 	}
 	
 	private void prepare(URLClassLoader urlClassLoader, String crXml, String crCfg) throws JobDriverException {
+		String location = "prepare";
 		if(urlClassLoader == null) {
-			throw new JobDriverException("missing URLClassLoader");
+			JobDriverException e = new JobDriverException("missing URLClassLoader");
+			logger.error(location, IEntityId.null_id, e);
+			throw e;
 		}
 		setURLClassLoader(urlClassLoader);
 		if(crXml == null) {
-			throw new JobDriverException("missing CollectionReader xml");
+			JobDriverException e = new JobDriverException("missing CollectionReader xml");
+			logger.error(location, IEntityId.null_id, e);
+			throw e;
 		}
 		setCrXml(crXml);
 		setCrCfg(crCfg);
@@ -150,6 +159,7 @@ public class JobDriverCollectionReader {
 	}
 	
 	private void initialize() throws JobDriverException {
+		String location = "initialize";
 		try {
 			class_JdUserCollectionReader = urlClassLoader.loadClass("org.apache.uima.ducc.user.jd.JdUserCollectionReader");
 			Constructor<?> constructor_JdUserCollectionReader = class_JdUserCollectionReader.getConstructor(String.class,String.class);
@@ -157,27 +167,23 @@ public class JobDriverCollectionReader {
 			method_getTotal = class_JdUserCollectionReader.getMethod(name_getTotal, nullClassArray);
 			class_JdUserMetaCas = urlClassLoader.loadClass("org.apache.uima.ducc.user.jd.JdUserMetaCas");
 			method_getJdUserMetaCas = class_JdUserCollectionReader.getMethod(name_getJdUserMetaCas, nullClassArray);
-		} catch (ClassNotFoundException e) {
-			JobDriverException jobDriverException = new JobDriverException(e);
-			throw jobDriverException;
-		} catch (NoSuchMethodException e) {
-			JobDriverException jobDriverException = new JobDriverException(e);
-			throw jobDriverException;
-		} catch (SecurityException e) {
-			JobDriverException jobDriverException = new JobDriverException(e);
-			throw jobDriverException;
-		} catch (InstantiationException e) {
-			JobDriverException jobDriverException = new JobDriverException(e);
-			throw jobDriverException;
-		} catch (IllegalAccessException e) {
-			JobDriverException jobDriverException = new JobDriverException(e);
-			throw jobDriverException;
-		} catch (IllegalArgumentException e) {
-			JobDriverException jobDriverException = new JobDriverException(e);
-			throw jobDriverException;
-		} catch (InvocationTargetException e) {
-			JobDriverException jobDriverException = new JobDriverException(e);
-			throw jobDriverException;
+			//
+			Method[] classMethods = class_JdUserCollectionReader.getMethods();
+			for(Method method : classMethods) {
+				if(method.getName().equals("deserialize")) {
+					Type[] types = method.getParameterTypes();
+					if(types.length == 1) {
+						if(types[0].toString().contains(".String")) {
+							method_deserialize = method;
+							break;
+						}
+					}
+				}
+			}
+		} 
+		catch (Exception e) {
+			logger.error(location, IEntityId.null_id, e);
+			throw new JobDriverException(e);
 		}
 	}
 	
@@ -203,7 +209,9 @@ public class JobDriverCollectionReader {
 			MessageBuffer mb = new MessageBuffer();
 			mb.append(Standardize.Label.loaded.get()+loadedClass.getName());
 			logger.debug(location, IEntityId.null_id, mb.toString());
-		} catch (ClassNotFoundException e) {
+		} 
+		catch (Exception e) {
+			logger.error(location, IEntityId.null_id, e);
 			throw new JobDriverException(e);
 		}
 	}

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ProxyJobDriverErrorHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ProxyJobDriverErrorHandler.java?rev=1637572&r1=1637571&r2=1637572&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ProxyJobDriverErrorHandler.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ProxyJobDriverErrorHandler.java Sat Nov  8 15:19:08 2014
@@ -51,12 +51,10 @@ public class ProxyJobDriverErrorHandler 
 		initialize(classPath, className, initializationData);
 	}
 	
-	public ProxyJobDriverErrorHandler(String[] classPath, String initializationData) throws JobDriverException {
-		String className = defaultClassName;
-		initialize(classPath, className, initializationData);
-	}
-	
-	public ProxyJobDriverErrorHandler(String[] classPath, String initializationData, String className) throws JobDriverException {
+	public ProxyJobDriverErrorHandler(String[] classPath, String className, String initializationData) throws JobDriverException {
+		if(className == null) {
+			className = defaultClassName;
+		}
 		initialize(classPath, className, initializationData);
 	}
 	
@@ -82,7 +80,7 @@ public class ProxyJobDriverErrorHandler 
 				if(method.getName().equals("handle")) {
 					Type[] types = method.getParameterTypes();
 					if(types.length == 2) {
-						if(types[0].toString().contains("CAS")) {
+						if(types[0].toString().contains("String")) {
 							if(types[1].toString().contains("Exception")) {
 								methodInstanceHandle = method;
 								break;
@@ -108,28 +106,27 @@ public class ProxyJobDriverErrorHandler 
 					}
 				}
 			}
-		} catch (Exception e) {
+		} 
+		catch (Exception e) {
 			logger.error(location, IEntityId.null_id, e);
 			throw new JobDriverException(e);
 		}
 	}
 	
-	public ProxyJobDriverDirective handle(Object cas, Object exception) throws JobDriverException {
+	public ProxyJobDriverDirective handle(Object serializedCAS, Object exception) throws JobDriverException {
 		String location = "handle";
 		ProxyJobDriverDirective retVal = null;
 		try {
-			if(cas != null) {
-				System.out.println("cas: "+cas.getClass().getName());
-			}
-			if(exception != null) {
-				System.out.println("exception: "+exception.getClass().getName());
-			}
-			Object directive = methodInstanceHandle.invoke(objectInstance, cas, exception);
+			Object[] plist = new Object[2];
+			plist[0] = serializedCAS;
+			plist[1] = exception;
+			Object directive = methodInstanceHandle.invoke(objectInstance, plist);
 			boolean isKillJob = (Boolean) methodInstanceIsKillJob.invoke(directive);
 			boolean isKillProcess = (Boolean) methodInstanceIsKillProcess.invoke(directive);
 			boolean isKillWorkItem = (Boolean) methodInstanceIsKillWorkItem.invoke(directive);
 			retVal = new ProxyJobDriverDirective(isKillJob, isKillProcess, isKillWorkItem);
-		} catch (Exception e) {
+		} 
+		catch (Exception e) {
 			logger.error(location, IEntityId.null_id, e);
 			throw new JobDriverException(e);
 		}

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestClassLoading.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestClassLoading.java?rev=1637572&r1=1637571&r2=1637572&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestClassLoading.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestClassLoading.java Sat Nov  8 15:19:08 2014
@@ -18,10 +18,17 @@
 */
 package org.apache.uima.ducc.container.jd.test;
 
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.io.File;
+import java.net.URL;
+
+import org.apache.uima.ducc.container.jd.classload.ProxyJobDriverCollectionReader;
+import org.apache.uima.ducc.container.jd.classload.ProxyJobDriverDirective;
 import org.apache.uima.ducc.container.jd.classload.ProxyJobDriverErrorHandler;
 import org.apache.uima.ducc.container.jd.test.helper.Utilities;
+import org.apache.uima.ducc.container.net.impl.MetaCas;
 import org.junit.Test;
 
 public class TestClassLoading extends ATest {
@@ -33,9 +40,9 @@ public class TestClassLoading extends AT
 		}
 		try {
 			ProxyJobDriverErrorHandler pjdeh = new ProxyJobDriverErrorHandler(Utilities.userCP);
-			Object cas = null;
+			Object serializedCAS = null;
 			Object exception = null;
-			pjdeh.handle(cas, exception);
+			pjdeh.handle(serializedCAS, exception);
 		}
 		catch(Exception e) {
 			e.printStackTrace();
@@ -43,4 +50,68 @@ public class TestClassLoading extends AT
 		}
 	}
 
+	@Test
+	public void test_02() {
+		if(isDisabled(this.getClass().getName())) {
+			return;
+		}
+		try {
+			String[] userCP = Utilities.userCP;
+			URL urlXml = this.getClass().getResource("/CR100.xml");
+			File file = new File(urlXml.getFile());
+			String crXml = file.getAbsolutePath();
+			String crCfg = null;
+			URL[] classLoaderUrls = new URL[userCP.length];
+			int i = 0;
+			for(String jar : userCP) {
+				classLoaderUrls[i] = this.getClass().getResource(jar);
+				i++;
+			}
+			ProxyJobDriverCollectionReader pjdcr = new ProxyJobDriverCollectionReader(classLoaderUrls, crXml, crCfg);
+			MetaCas mc = pjdcr.getMetaCas();
+			Object serializedCAS = mc.getSerializedCas();
+			Object exception = null;
+			ProxyJobDriverErrorHandler pjdeh = new ProxyJobDriverErrorHandler(Utilities.userCP);
+			pjdeh.handle(serializedCAS, exception);
+		}
+		catch(Exception e) {
+			e.printStackTrace();
+			fail("Exception");
+		}
+	}
+	
+
+	@Test
+	public void test_03() {
+		if(isDisabled(this.getClass().getName())) {
+			return;
+		}
+		try {
+			String[] userCP = Utilities.userCP;
+			URL urlXml = this.getClass().getResource("/CR100.xml");
+			File file = new File(urlXml.getFile());
+			String crXml = file.getAbsolutePath();
+			String crCfg = null;
+			URL[] classLoaderUrls = new URL[userCP.length];
+			int i = 0;
+			for(String jar : userCP) {
+				classLoaderUrls[i] = this.getClass().getResource(jar);
+				i++;
+			}
+			ProxyJobDriverCollectionReader pjdcr = new ProxyJobDriverCollectionReader(classLoaderUrls, crXml, crCfg);
+			MetaCas mc = pjdcr.getMetaCas();
+			Object serializedCAS = mc.getSerializedCas();
+			Object exception = null;
+			String className = "org.apache.uima.ducc.user.jd.test.helper.TestJdContainerErrorHandler";
+			ProxyJobDriverErrorHandler pjdeh = new ProxyJobDriverErrorHandler(Utilities.userCP, className, null);
+			ProxyJobDriverDirective directive = pjdeh.handle(serializedCAS, exception);
+			assertTrue(directive.isKillJob() == true);
+			assertTrue(directive.isKillProcess() == true);
+			assertTrue(directive.isKillWorkItem() == false);
+		}
+		catch(Exception e) {
+			e.printStackTrace();
+			fail("Exception");
+		}
+	}
 }

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestSuite.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestSuite.java?rev=1637572&r1=1637571&r2=1637572&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestSuite.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestSuite.java Sat Nov  8 15:19:08 2014
@@ -27,7 +27,7 @@ import java.net.URL;
 import org.apache.uima.ducc.container.jd.JobDriverException;
 import org.apache.uima.ducc.container.jd.cas.CasManager;
 import org.apache.uima.ducc.container.jd.cas.CasManagerStats.RetryReason;
-import org.apache.uima.ducc.container.jd.classload.JobDriverCollectionReader;
+import org.apache.uima.ducc.container.jd.classload.ProxyJobDriverCollectionReader;
 import org.apache.uima.ducc.container.jd.mh.RemoteWorkerIdentity;
 import org.apache.uima.ducc.container.jd.mh.impl.OperatingInfo;
 import org.apache.uima.ducc.container.jd.test.helper.Utilities;
@@ -52,7 +52,7 @@ public class TestSuite extends ATest {
 				classLoaderUrls[i] = this.getClass().getResource(jar);
 				i++;
 			}
-			new JobDriverCollectionReader(classLoaderUrls, crXml, crCfg);
+			new ProxyJobDriverCollectionReader(classLoaderUrls, crXml, crCfg);
 		}
 		catch(Exception e) {
 			e.printStackTrace();
@@ -88,7 +88,7 @@ public class TestSuite extends ATest {
 				}
 			}
 			try {
-				new JobDriverCollectionReader(classLoaderUrls, crXml, crCfg);
+				new ProxyJobDriverCollectionReader(classLoaderUrls, crXml, crCfg);
 				fail("Exception missing...?");
 			}
 			catch(JobDriverException e) {
@@ -124,7 +124,7 @@ public class TestSuite extends ATest {
 				classLoaderUrls[i] = this.getClass().getResource(jar);
 				i++;
 			}
-			new JobDriverCollectionReader(classLoaderUrls, crXml, crCfg);
+			new ProxyJobDriverCollectionReader(classLoaderUrls, crXml, crCfg);
 			fail("Exception missing...?");
 		}
 		catch(JobDriverException e) {
@@ -154,8 +154,8 @@ public class TestSuite extends ATest {
 				classLoaderUrls[i] = this.getClass().getResource(jar);
 				i++;
 			}
-			JobDriverCollectionReader jdcr = new JobDriverCollectionReader(classLoaderUrls, crXml, crCfg);
-			int total = jdcr.getTotal();
+			ProxyJobDriverCollectionReader pjdcr = new ProxyJobDriverCollectionReader(classLoaderUrls, crXml, crCfg);
+			int total = pjdcr.getTotal();
 			assertTrue(total == 100);
 			debug("total: "+total);
 		}
@@ -185,8 +185,8 @@ public class TestSuite extends ATest {
 				classLoaderUrls[i] = this.getClass().getResource(jar);
 				i++;
 			}
-			JobDriverCollectionReader jdcr = new JobDriverCollectionReader(classLoaderUrls, crXml, crCfg);
-			MetaCas mc = jdcr.getMetaCas();
+			ProxyJobDriverCollectionReader pjdcr = new ProxyJobDriverCollectionReader(classLoaderUrls, crXml, crCfg);
+			MetaCas mc = pjdcr.getMetaCas();
 			int seqNo = mc.getSeqNo();
 			asExpected("seqNo = "+seqNo);
 			assertTrue(seqNo == 1);
@@ -215,9 +215,9 @@ public class TestSuite extends ATest {
 		getMetaCas(Utilities.userCP, crXml, crCfg);
 	}
 	
-	private void getMetaCases(JobDriverCollectionReader jdcr, int total) throws JobDriverException {
+	private void getMetaCases(ProxyJobDriverCollectionReader pjdcr, int total) throws JobDriverException {
 		for(int c=1; c <= total; c++) {
-			MetaCas mc = jdcr.getMetaCas();
+			MetaCas mc = pjdcr.getMetaCas();
 			int seqNo = mc.getSeqNo();
 			asExpected("seqNo = "+seqNo);
 			assertTrue(seqNo == c);
@@ -238,12 +238,12 @@ public class TestSuite extends ATest {
 				classLoaderUrls[i] = this.getClass().getResource(jar);
 				i++;
 			}
-			JobDriverCollectionReader jdcr = new JobDriverCollectionReader(classLoaderUrls, crXml, crCfg);
-			int total = jdcr.getTotal();
-			getMetaCases(jdcr, total);
+			ProxyJobDriverCollectionReader pjdcr = new ProxyJobDriverCollectionReader(classLoaderUrls, crXml, crCfg);
+			int total = pjdcr.getTotal();
+			getMetaCases(pjdcr, total);
 			if(extra > 0) {
 				for(int j=0; j<extra; j++) {
-					MetaCas mc = jdcr.getMetaCas();
+					MetaCas mc = pjdcr.getMetaCas();
 					assertTrue(mc == null);
 				}
 			}

Added: uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/user/jd/test/helper/TestJdContainerErrorHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/user/jd/test/helper/TestJdContainerErrorHandler.java?rev=1637572&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/user/jd/test/helper/TestJdContainerErrorHandler.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/user/jd/test/helper/TestJdContainerErrorHandler.java Sat Nov  8 15:19:08 2014
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc.user.jd.test.helper;
+
+import org.apache.uima.ducc.user.jd.iface.IJdUserDirective;
+import org.apache.uima.ducc.user.jd.iface.JdUserDirective;
+import org.apache.uima.ducc.user.jd.iface.JdUserErrorHandler;
+
+public class TestJdContainerErrorHandler extends JdUserErrorHandler {
+
+	@Override
+	public IJdUserDirective handle(String serializedCAS, Exception e) {
+		JdUserDirective jdUserDirective = new JdUserDirective();
+		jdUserDirective.setKillJob();
+		jdUserDirective.setKillProcess();
+		jdUserDirective.resetKillWorkItem();
+		return jdUserDirective;
+	}
+
+}

Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/user/jd/test/helper/TestJdContainerErrorHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/iface/IJdUserErrorHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/iface/IJdUserErrorHandler.java?rev=1637572&r1=1637571&r2=1637572&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/iface/IJdUserErrorHandler.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/iface/IJdUserErrorHandler.java Sat Nov  8 15:19:08 2014
@@ -18,9 +18,7 @@
 */
 package org.apache.uima.ducc.user.jd.iface;
 
-import org.apache.uima.cas.CAS;
-
 public interface IJdUserErrorHandler {
 	public void initialize(String initializationData);
-	public IJdUserDirective handle(CAS cas, Exception e);
+	public IJdUserDirective handle(String serializedCAS, Exception exception);
 }
\ No newline at end of file

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/iface/JdUserErrorHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/iface/JdUserErrorHandler.java?rev=1637572&r1=1637571&r2=1637572&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/iface/JdUserErrorHandler.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/iface/JdUserErrorHandler.java Sat Nov  8 15:19:08 2014
@@ -23,7 +23,6 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import org.apache.uima.cas.CAS;
 import org.apache.uima.ducc.user.common.QuotedOptions;
 import org.apache.uima.ducc.user.jd.JdUser;
 
@@ -87,11 +86,22 @@ public class JdUserErrorHandler implemen
 	}
 	
 	@Override
-	public IJdUserDirective handle(CAS cas, Exception e) {
+	public IJdUserDirective handle(String serializedCAS, Exception exception) {
 		JdUserDirective jdUserDirective = new JdUserDirective();
-		jobErrorCount.incrementAndGet();
-		if(jobErrorCount.get() > jobErrorLimit.get()) {
-			jdUserDirective.setKillJob();
+		try {
+			if(serializedCAS != null) {
+				// CAS is provided
+			}
+			if(exception != null) {
+				// Exception is provided
+			}
+			jobErrorCount.incrementAndGet();
+			if(jobErrorCount.get() > jobErrorLimit.get()) {
+				jdUserDirective.setKillJob();
+			}
+		}
+		catch(Exception e) {
+			e.printStackTrace();
 		}
 		return jdUserDirective;
 	}

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/TestSuite.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/TestSuite.java?rev=1637572&r1=1637571&r2=1637572&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/TestSuite.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/TestSuite.java Sat Nov  8 15:19:08 2014
@@ -24,7 +24,6 @@ import static org.junit.Assert.fail;
 import java.io.File;
 import java.net.URL;
 
-import org.apache.uima.cas.CAS;
 import org.apache.uima.ducc.user.jd.JdUserCollectionReader;
 import org.apache.uima.ducc.user.jd.JdUserException;
 import org.apache.uima.ducc.user.jd.JdUserMetaCas;
@@ -32,6 +31,7 @@ import org.apache.uima.ducc.user.jd.ifac
 import org.apache.uima.ducc.user.jd.iface.IJdUserErrorHandler;
 import org.apache.uima.ducc.user.jd.iface.JdUserErrorHandler;
 import org.apache.uima.ducc.user.jd.iface.JdUserErrorHandler.InitializationDataKey;
+import org.apache.uima.ducc.user.jd.test.helper.TestJdUserErrorHandler;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -179,9 +179,9 @@ public class TestSuite {
 	public void test06() {
 		try {
 			IJdUserErrorHandler eh = new JdUserErrorHandler();
-			CAS cas = null;
+			String serializedCAS = null;
 			Exception exception = null;
-			IJdUserDirective directive = eh.handle(cas, exception);
+			IJdUserDirective directive = eh.handle(serializedCAS, exception);
 			assertTrue(directive.isKillJob() == false);
 			assertTrue(directive.isKillProcess() == false);
 			assertTrue(directive.isKillWorkItem() == true);
@@ -206,10 +206,9 @@ public class TestSuite {
 			JdUserMetaCas jdUserMetaCas = null;
 			jdUserMetaCas = jdcr.getJdUserMetaCas();
 			assertTrue(jdUserMetaCas != null);
-			String serializedCas = jdUserMetaCas.getSerializedCas();
-			assertTrue(serializedCas != null);
+			String serializedCAS = jdUserMetaCas.getSerializedCas();
+			assertTrue(serializedCAS != null);
 			//
-			CAS cas = jdcr.deserialize(serializedCas);
 			Exception exception = null;
 			JdUserErrorHandler eh = null;
 			IJdUserDirective directive = null;
@@ -218,14 +217,14 @@ public class TestSuite {
 			//
 			exception = null;
 			eh = new JdUserErrorHandler();
-			directive = eh.handle(cas, exception);
+			directive = eh.handle(serializedCAS, exception);
 			assertTrue(directive.isKillJob() == false);
 			assertTrue(directive.isKillProcess() == false);
 			assertTrue(directive.isKillWorkItem() == true);
 			//
 			exception = new RuntimeException();
 			eh = new JdUserErrorHandler();
-			directive = eh.handle(cas, exception);
+			directive = eh.handle(serializedCAS, exception);
 			assertTrue(directive.isKillJob() == false);
 			assertTrue(directive.isKillProcess() == false);
 			assertTrue(directive.isKillWorkItem() == true);
@@ -233,14 +232,14 @@ public class TestSuite {
 			limit = 15;
 			exception = new RuntimeException();
 			eh = new JdUserErrorHandler();
-			directive = eh.handle(cas, exception);
+			directive = eh.handle(serializedCAS, exception);
 			for(int i=1; i<limit; i++) {
-				directive = eh.handle(cas, exception);
+				directive = eh.handle(serializedCAS, exception);
 				assertTrue(directive.isKillJob() == false);
 				assertTrue(directive.isKillProcess() == false);
 				assertTrue(directive.isKillWorkItem() == true);
 			}
-			directive = eh.handle(cas, exception);
+			directive = eh.handle(serializedCAS, exception);
 			assertTrue(directive.isKillJob() == true);
 			assertTrue(directive.isKillProcess() == false);
 			assertTrue(directive.isKillWorkItem() == true);
@@ -249,14 +248,14 @@ public class TestSuite {
 			exception = new RuntimeException();
 			plist = InitializationDataKey.KillJobLimit.name()+"="+limit;
 			eh = new JdUserErrorHandler(plist);
-			directive = eh.handle(cas, exception);
+			directive = eh.handle(serializedCAS, exception);
 			for(int i=1; i<limit; i++) {
-				directive = eh.handle(cas, exception);
+				directive = eh.handle(serializedCAS, exception);
 				assertTrue(directive.isKillJob() == false);
 				assertTrue(directive.isKillProcess() == false);
 				assertTrue(directive.isKillWorkItem() == true);
 			}
-			directive = eh.handle(cas, exception);
+			directive = eh.handle(serializedCAS, exception);
 			assertTrue(directive.isKillJob() == true);
 			assertTrue(directive.isKillProcess() == false);
 			assertTrue(directive.isKillWorkItem() == true);
@@ -265,19 +264,17 @@ public class TestSuite {
 			exception = new RuntimeException();
 			plist = InitializationDataKey.KillJobLimit.name()+"="+limit;
 			eh = new JdUserErrorHandler(plist);
-			directive = eh.handle(cas, exception);
+			directive = eh.handle(serializedCAS, exception);
 			for(int i=1; i<limit; i++) {
-				directive = eh.handle(cas, exception);
+				directive = eh.handle(serializedCAS, exception);
 				assertTrue(directive.isKillJob() == false);
 				assertTrue(directive.isKillProcess() == false);
 				assertTrue(directive.isKillWorkItem() == true);
 			}
-			directive = eh.handle(cas, exception);
+			directive = eh.handle(serializedCAS, exception);
 			assertTrue(directive.isKillJob() == true);
 			assertTrue(directive.isKillProcess() == false);
 			assertTrue(directive.isKillWorkItem() == true);
-			//
-			jdcr.recycle(cas);
 		}
 		catch(Exception e) {
 			e.printStackTrace();
@@ -288,6 +285,28 @@ public class TestSuite {
 	@Test
 	public void test08() {
 		try {
+			//
+			String serializedCAS = null;
+			Exception exception = null;
+			TestJdUserErrorHandler eh = null;
+			IJdUserDirective directive = null;
+			//
+			exception = null;
+			eh = new TestJdUserErrorHandler();
+			directive = eh.handle(serializedCAS, exception);
+			assertTrue(directive.isKillJob() == true);
+			assertTrue(directive.isKillProcess() == true);
+			assertTrue(directive.isKillWorkItem() == false);
+		}
+		catch(Exception e) {
+			e.printStackTrace();
+			fail("Exception");
+		}
+	}
+	
+	@Test
+	public void test09() {
+		try {
 			int seqNo = 1;
 			String serializedCas = "ABC";
 			String documentText = "123";

Added: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/helper/TestJdUserErrorHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/helper/TestJdUserErrorHandler.java?rev=1637572&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/helper/TestJdUserErrorHandler.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/helper/TestJdUserErrorHandler.java Sat Nov  8 15:19:08 2014
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc.user.jd.test.helper;
+
+import org.apache.uima.ducc.user.jd.iface.IJdUserDirective;
+import org.apache.uima.ducc.user.jd.iface.JdUserDirective;
+import org.apache.uima.ducc.user.jd.iface.JdUserErrorHandler;
+
+public class TestJdUserErrorHandler extends JdUserErrorHandler {
+
+	@Override
+	public IJdUserDirective handle(String serializedCAS, Exception e) {
+		JdUserDirective jdUserDirective = new JdUserDirective();
+		jdUserDirective.setKillJob();
+		jdUserDirective.setKillProcess();
+		jdUserDirective.resetKillWorkItem();
+		return jdUserDirective;
+	}
+
+}

Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/helper/TestJdUserErrorHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native