You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2012/02/10 19:49:49 UTC

svn commit: r1242883 - in /incubator/airavata/trunk/modules: distribution/src/main/resources/conf/xbaya.properties xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java

Author: lahiru
Date: Fri Feb 10 18:49:49 2012
New Revision: 1242883

URL: http://svn.apache.org/viewvc?rev=1242883&view=rev
Log:
fixing https://issues.apache.org/jira/browse/AIRAVATA-305.

Modified:
    incubator/airavata/trunk/modules/distribution/src/main/resources/conf/xbaya.properties
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java

Modified: incubator/airavata/trunk/modules/distribution/src/main/resources/conf/xbaya.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/distribution/src/main/resources/conf/xbaya.properties?rev=1242883&r1=1242882&r2=1242883&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/distribution/src/main/resources/conf/xbaya.properties (original)
+++ incubator/airavata/trunk/modules/distribution/src/main/resources/conf/xbaya.properties Fri Feb 10 18:49:49 2012
@@ -5,3 +5,4 @@ jcr.password=admin
 provenance=true
 jcr.url=http://localhost:8081/rmi
 runInThread=false
+provenanceWriterThreadPoolSize=20
\ No newline at end of file

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java?rev=1242883&r1=1242882&r2=1242883&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java Fri Feb 10 18:49:49 2012
@@ -71,7 +71,8 @@ public class WorkflowInterpretorSkeleton
     public static final String RUN_IN_THREAD = "runInThread";
     private static PredicatedTaskRunner runner = null;
     public static  JCRComponentRegistry jcrComponentRegistry = null;
-
+    public static int provenanceWriterThreadPoolSize = 1;
+    public static final String PROVENANCE_WRITER_THREAD_POOL_SIZE = "provenanceWriterThreadPoolSize";
 
     public void startUp(ConfigurationContext configctx, AxisService service) {
         URL url = this.getClass().getClassLoader().getResource("xbaya.properties");
@@ -84,10 +85,11 @@ public class WorkflowInterpretorSkeleton
             jcrUserName = (String)properties.get(JCR_USER);
             jcrPassword = (String) properties.get(JCR_PASS);
             jcrURL = (String) properties.get(JCR_URL);
+            provenanceWriterThreadPoolSize = Integer.parseInt((String)properties.get(PROVENANCE_WRITER_THREAD_POOL_SIZE));
 
             if("true".equals(properties.get(PROVENANCE))){
                 provenance = true;
-                runner = new PredicatedTaskRunner(1);
+                runner = new PredicatedTaskRunner(provenanceWriterThreadPoolSize);
                 try {
                     jcrComponentRegistry = new JCRComponentRegistry(new URI(jcrURL),jcrUserName,jcrPassword);
                 } catch (RepositoryException e) {
@@ -180,26 +182,27 @@ public class WorkflowInterpretorSkeleton
         final WorkflowInterpreter finalInterpreter = interpreter;
         interpreter.setActOnProvenance(provenance);
         interpreter.setProvenanceWriter(runner);
+        final String experimentId = topic;
         System.err.println("Created the interpreter");
         if(inNewThread){
-            runInThread(finalInterpreter,finalListener);
+            runInThread(finalInterpreter,finalListener,experimentId);
         }else{
-            executeWorkflow(finalInterpreter,finalListener);
+            executeWorkflow(finalInterpreter,finalListener,experimentId);
         }
         System.err.println("topic return:" + topic);
         return topic;
     }
 
-    private void runInThread(final WorkflowInterpreter interpreter,final WorkflowInterpretorEventListener listener) {
+    private void runInThread(final WorkflowInterpreter interpreter,final WorkflowInterpretorEventListener listener,final String experimentId) {
         new Thread(new Runnable() {
 
             public void run() {
-                executeWorkflow(interpreter, listener);
+                executeWorkflow(interpreter, listener,experimentId);
             }
         }).start();
     }
 
-    private void executeWorkflow(WorkflowInterpreter interpreter, WorkflowInterpretorEventListener listener) {
+    private void executeWorkflow(WorkflowInterpreter interpreter, WorkflowInterpretorEventListener listener,String experimentId) {
         try {
             interpreter.scheduleDynamically();
             System.err.println("Called the interpreter");
@@ -241,5 +244,8 @@ public class WorkflowInterpretorSkeleton
 	}
      public void shutDown(ConfigurationContext configctx, AxisService service) {
             ((JCRRegistry)jcrComponentRegistry.getRegistry()).closeConnection();
+         if(runner != null){
+             runner.shutDown();
+         }
     }
 }