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 2013/06/21 17:53:21 UTC

svn commit: r1495483 - in /airavata/trunk/modules: ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WseMsgBrokerClient.java xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorEventListener.java

Author: lahiru
Date: Fri Jun 21 15:53:21 2013
New Revision: 1495483

URL: http://svn.apache.org/r1495483
Log:
fixing https://issues.apache.org/jira/browse/AIRAVATA-872.

Modified:
    airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WseMsgBrokerClient.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorEventListener.java

Modified: airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WseMsgBrokerClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WseMsgBrokerClient.java?rev=1495483&r1=1495482&r2=1495483&view=diff
==============================================================================
--- airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WseMsgBrokerClient.java (original)
+++ airavata/trunk/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WseMsgBrokerClient.java Fri Jun 21 15:53:21 2013
@@ -108,14 +108,12 @@ public class WseMsgBrokerClient extends 
             long expireTime) throws MsgBrokerClientException {
 
         String subscriptionId = null;
-
+        ServiceClient serviceClient = null;
         try {
             OMElement subscriptionMsg = WSEProtocolClient.createSubscription(eventSinkLocation, topicExpression,
                     xpathExpression, expireTime);
-            ServiceClient serviceClient = configureServiceClientForSubscription(subscriptionMsg);
+            serviceClient = configureServiceClientForSubscription(subscriptionMsg);
             OMElement responseMessage = serviceClient.sendReceive(subscriptionMsg);
-            serviceClient.cleanup();
-            serviceClient.cleanupTransport();
 
             if (responseMessage == null) {
                 throw new MsgBrokerClientException("no response recieved for subscription message");
@@ -128,6 +126,13 @@ public class WseMsgBrokerClient extends 
 
         } catch (AxisFault e) {
             throw new MsgBrokerClientException("unable to send the subscription", e);
+        } finally {
+            try {
+                serviceClient.cleanup();
+                serviceClient.cleanupTransport();
+            } catch (AxisFault e) {
+                throw new MsgBrokerClientException("unable to send the subscription", e);
+            }
         }
 
         return subscriptionId;
@@ -136,7 +141,7 @@ public class WseMsgBrokerClient extends 
     public boolean unSubscribe(String subscriptionId) throws MsgBrokerClientException {
         OMFactory factory = OMAbstractFactory.getOMFactory();
         OMElement message = WSEProtocolClient.createUnsubscribeMsg();
-
+        ServiceClient client = null;
         OMElement identifierEl = factory.createOMElement("Identifier", message.getNamespace());
 
         identifierEl.setText(subscriptionId);
@@ -145,18 +150,20 @@ public class WseMsgBrokerClient extends 
         Options opts = CommonRoutines.getOptions(soapAction, getTimeoutInMilliSeconds(), brokerEndpointRef);
 
         try {
-            ServiceClient client = new ServiceClient();
+            client = new ServiceClient();
             client.setOptions(opts);
             CommonRoutines.setHeaders(soapAction, brokerEndpointRef.getAddress(), client, identifierEl);
-
             client.sendReceive(message);
-            client.cleanup();
-            client.cleanupTransport();
-
         } catch (AxisFault e) {
-            throw new MsgBrokerClientException("unable to send subscribe msg", e);
+            throw new MsgBrokerClientException("unable to send unsubscribe msg", e);
+        } finally {
+            try {
+                client.cleanup();
+                client.cleanupTransport();
+            } catch (AxisFault e) {
+                throw new MsgBrokerClientException("unable to send unsubscribe msg", e);
+            }
         }
-
         return true;
     }
 

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorEventListener.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorEventListener.java?rev=1495483&r1=1495482&r2=1495483&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorEventListener.java (original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorEventListener.java Fri Jun 21 15:53:21 2013
@@ -55,6 +55,7 @@ import org.apache.airavata.xbaya.graph.c
 import org.apache.airavata.xbaya.provenance.WorkflowNodeStatusUpdater;
 import org.apache.airavata.xbaya.provenance.WorkflowStatusUpdater;
 import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -133,10 +134,16 @@ public class WorkflowInterpretorEventLis
         try {
             if (this.pullMode) {
                 this.messagePuller.stopPulling();
+                try {
+                    Thread.sleep(100);
+                } catch (InterruptedException e) {
+                    throw new MonitorException("Error during stop message puller", e);
+                }
 //            } else {
 //                this.wseClient.unSubscribe(this.subscriptionID);
             }
             this.wseClient.unSubscribe(this.subscriptionID);
+
         } catch (MsgBrokerClientException e) {
             throw new MonitorException("Failed to unsubscribe.", e);
         }
@@ -210,6 +217,7 @@ public class WorkflowInterpretorEventLis
         } else if (type == EventType.RECEIVED_FAULT
                 || type == EventType.SENDING_FAULT || type == EventType.SENDING_RESPONSE_FAILED) {
             //Constructing NodeExecutionError with required data...
+            logger.error(event.getMessage());
             NodeExecutionError nodeExecutionError = new NodeExecutionError();
             nodeExecutionError.setExperimentId(event.getExperimentID());
             nodeExecutionError.setNodeId(event.getNodeID());