Author: lahiru
Date: Thu May  2 21:31:30 2013
New Revision: 1478568

URL: http://svn.apache.org/r1478568
Log:
fixing thread synchronizing issue with concurrent node execution of workflow.

Modified:
    
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java

Modified: 
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java?rev=1478568&r1=1478567&r2=1478568&view=diff
==============================================================================
--- 
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
 (original)
+++ 
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
 Thu May  2 21:31:30 2013
@@ -163,6 +163,7 @@ public class WorkflowInterpreter {
                        this.config.getNotifier().workflowStarted(values, 
keywords);
                        
this.config.getConfiguration().setContextHeader(WorkflowContextHeaderBuilder.getCurrentContextHeader());
 
+            int lastReadNodeSize = -1;
                        while (this.getWorkflow().getExecutionState() != 
WorkflowExecutionState.STOPPED) {
                                if (getRemainNodesDynamically() == 0) {
                                        
notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED, 
WorkflowExecutionState.PAUSED);
@@ -177,6 +178,14 @@ public class WorkflowInterpreter {
                                }
                                // get task list and execute them
                                ArrayList<Node> readyNodes = 
this.getReadyNodesDynamically();
+                while(lastReadNodeSize != 0 && lastReadNodeSize == 
readyNodes.size()){
+                    try {
+                                               Thread.sleep(400);
+                                       } catch (InterruptedException e) {
+                                               e.printStackTrace();
+                                       }
+                }
+                lastReadNodeSize = readyNodes.size();
                                for (final Node node : readyNodes) {
                                        if (node.isBreak()) {
                                                this.notifyPause();


Reply via email to