Author: cwiklik
Date: Thu Apr 21 19:27:49 2016
New Revision: 1740389
URL: http://svn.apache.org/viewvc?rev=1740389&view=rev
Log:
UIMA-4904 after SIGTERM the JP should stop communicating with a JD
Modified:
uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configuration/jp/HttpWorkerThread.java
Modified:
uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configuration/jp/HttpWorkerThread.java
URL:
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configuration/jp/HttpWorkerThread.java?rev=1740389&r1=1740388&r2=1740389&view=diff
==============================================================================
---
uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configuration/jp/HttpWorkerThread.java
(original)
+++
uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configuration/jp/HttpWorkerThread.java
Thu Apr 21 19:27:49 2016
@@ -285,6 +285,11 @@ public class HttpWorkerThread implements
// to the JD. The
actual serialized stack trace is wrapped in
//
RuntimeException->AnalysisEngineException.message
workItemFailed = true;
+ // if WI processing
fails while the service changes states to !Running
+ // ignore results and
terminate this thread.
+ if (
!duccComponent.isRunning() ) {
+ break;
+ }
IMetaCas mc =
transaction.getMetaCas();
// Fetch serialized
exception as a blob
@@ -296,6 +301,12 @@ public class HttpWorkerThread implements
logger.info("run",
null, "Work item processing failed - returning serialized exception to the JD");
} catch( Exception ee) {
workItemFailed = true;
+ // if WI processing
fails while the service changes states to !Running
+ // ignore results and
terminate this thread.
+ if (
!duccComponent.isRunning() ) {
+
logger.info("run", null, "Work item processing failed - terminating thread -
ignore any AE errors that may happen beyond this point");
+ break;
+ }
// Serialize exception
for the JD.
ByteArrayOutputStream
baos = new ByteArrayOutputStream();
ObjectOutputStream oos =
new ObjectOutputStream( baos );
@@ -313,6 +324,12 @@ public class HttpWorkerThread implements
TransactionId tid = new
TransactionId(major, minor++);
transaction.setTransactionId(tid);
+ // if WI processing fails while
the service changes states to !Running
+ // ignore results and terminate
this thread.
+ if ( !duccComponent.isRunning()
) {
+ break;
+ }
+
httpClient.execute(transaction,
postMethod); // Work Item Processed - End
String wid = null;
try {