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 2014/11/25 22:32:16 UTC
svn commit: r1641703 - in
/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configuration/jp:
JobProcessComponent.java JobProcessConfiguration.java
Author: cwiklik
Date: Tue Nov 25 21:32:16 2014
New Revision: 1641703
URL: http://svn.apache.org/r1641703
Log:
UIMA-4129 Use FlagsHelper for -D param names
Modified:
uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configuration/jp/JobProcessComponent.java
uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configuration/jp/JobProcessConfiguration.java
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configuration/jp/JobProcessComponent.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/JobProcessComponent.java?rev=1641703&r1=1641702&r2=1641703&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configuration/jp/JobProcessComponent.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configuration/jp/JobProcessComponent.java Tue Nov 25 21:32:16 2014
@@ -30,6 +30,7 @@ import org.apache.camel.CamelContext;
import org.apache.camel.Route;
import org.apache.uima.aae.UimaAsVersion;
import org.apache.uima.ducc.common.component.AbstractDuccComponent;
+import org.apache.uima.ducc.common.container.FlagsHelper;
import org.apache.uima.ducc.common.main.DuccService;
import org.apache.uima.ducc.common.utils.DuccLogger;
import org.apache.uima.ducc.container.jp.JobProcessManager;
@@ -52,6 +53,7 @@ public class JobProcessComponent extends
private int timeout = 30000; // default socket timeout for HTTPClient
private int threadSleepTime = 5000; // time to sleep between GET requests if JD sends null CAS
private IUimaProcessor uimaProcessor = null;
+ // define default class to use to invoke methods via reflection
private String containerClass = "org.apache.uima.ducc.user.jp.UimaProcessContainer";
;
@@ -100,12 +102,18 @@ public class JobProcessComponent extends
public void setTimeout(int timeout) {
this.timeout = timeout;
}
+ /**
+ * This method is called by super during ducc framework boot
+ * sequence. It creates all the internal components and worker threads
+ * and initiates processing. When threads exit, this method shuts down
+ * the components and returns.
+ */
public void start(DuccService service, String[] args) throws Exception {
super.start(service, args);
try {
// the JobProcessConfiguration checked if the below property exists
- String jps = System.getProperty(JobProcessConfiguration.USER_CP_KEY);
+ String jps = System.getProperty(FlagsHelper.Name.UserClasspath.name());
String processJmxUrl = super.getProcessJmxUrl();
// tell the agent that this process is initializing
@@ -177,15 +185,15 @@ public class JobProcessComponent extends
// Create thread pool and begin processing
getLogger().info("start", null, "Starting "+uimaProcessor.getScaleout()+" Process Threads");
+ // Create and start worker threads that pull Work Items from the JD
Future<?>[] threadHandles = new Future<?>[uimaProcessor.getScaleout()];
for (int j = 0; j < uimaProcessor.getScaleout(); j++) {
- threadHandles[j] =tpe.submit(new HttpWorkerThread(this, client, uimaProcessor));
+ threadHandles[j] = tpe.submit(new HttpWorkerThread(this, client, uimaProcessor));
}
- System.out.println(">>>>>>>>>>>>> Waiting for Threads to Exit");
for( Future<?> f : threadHandles ) {
- f.get();
+ f.get(); // wait for worker threads to exit
}
- System.out.println(">>>>>>>>>>>>> Threads Exited");
+ getLogger().info("start", null, "All Http Worker Threads Terminated");
} catch( Exception ee) {
ee.printStackTrace();
currentState = ProcessState.FailedInitialization;
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configuration/jp/JobProcessConfiguration.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/JobProcessConfiguration.java?rev=1641703&r1=1641702&r2=1641703&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configuration/jp/JobProcessConfiguration.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configuration/jp/JobProcessConfiguration.java Tue Nov 25 21:32:16 2014
@@ -43,7 +43,6 @@ import org.springframework.context.annot
@Import({ DuccTransportConfiguration.class, CommonConfiguration.class })
public class JobProcessConfiguration {
public static final String AGENT_ENDPOINT="mina:tcp://localhost:";
- public static final String USER_CP_KEY = "UserClasspath";
@Autowired
DuccTransportConfiguration transport;
@Autowired
@@ -111,9 +110,9 @@ public class JobProcessConfiguration {
}
}
private void checkPrereqs(DuccLogger logger) {
- if (null == System.getProperty(USER_CP_KEY)) {
- logger.error("start", null, "Missing the -D"+USER_CP_KEY+"=XXXX property");
- throw new RuntimeException("Missing the -D"+USER_CP_KEY+"=XXXX property");
+ if (null == System.getProperty(FlagsHelper.Name.UserClasspath.name())) {
+ logger.error("start", null, "Missing the -D"+FlagsHelper.Name.UserClasspath.name()+"=XXXX property");
+ throw new RuntimeException("Missing the -D"+FlagsHelper.Name.UserClasspath.name()+"=XXXX property");
}
if (null == common.saxonJarPath ){
logger.error("start", null, "Missing saxon jar path. Check your ducc.properties");
@@ -123,9 +122,9 @@ public class JobProcessConfiguration {
logger.error("start", null, "Missing dd2sping xsl path. Check your ducc.properties");
throw new RuntimeException("Missing dd2spring xsl path. Check your ducc.properties");
}
- if (null == System.getProperty("jdURL")) {
- logger.error("start", null, "Missing the -DjdURL property");
- throw new RuntimeException("Missing the -DjdURL property");
+ if (null == System.getProperty(FlagsHelper.Name.JdURL.name())) {
+ logger.error("start", null, "Missing the -D"+FlagsHelper.Name.JdURL+" property");
+ throw new RuntimeException("Missing the -D"+FlagsHelper.Name.JdURL+" property");
}