axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dee...@apache.org
Subject svn commit: r383492 - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2: context/MessageContext.java description/OutOnlyAxisOperation.java engine/AxisEngine.java
Date Mon, 06 Mar 2006 08:12:51 GMT
Author: deepal
Date: Mon Mar  6 00:12:49 2006
New Revision: 383492

URL: http://svn.apache.org/viewcvs?rev=383492&view=rev
Log:
-moved thread creation logic from OutOnlyOperationClient to AxisEngine , and operation client
will be set a flag in msgctx
if he want to invoke the transport sender in a separate thread 

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java?rev=383492&r1=383491&r2=383492&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
Mon Mar  6 00:12:49 2006
@@ -40,7 +40,7 @@
     public final static int IN_FAULT_FLOW = 3;
 
     public final static int OUT_FLOW = 2;
-    public final static int OUT_FAUTT_FLOW = 4;
+    public final static int OUT_FAULT_FLOW = 4;
 
     public static final String REMOTE_ADDR = "REMOTE_ADDR";
 
@@ -87,6 +87,13 @@
     // to keep a ref to figure out which path your are in the execution (send or
     // receive)
     public int FLOW = IN_FLOW;
+
+    /**
+     * To invoke fireAndforget method we have to hand over transport sening logic to a thread
+     * other wise user has to wait till it get transport response (in the case of HTTP its
HTTP
+     * 202)
+     */
+    public static final String TRANSPORT_NON_BLOCKING = "transportNonBlocking";
 
     /**
      * Field processingFault

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java?rev=383492&r1=383491&r2=383492&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java
Mon Mar  6 00:12:49 2006
@@ -12,8 +12,6 @@
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.engine.ListenerManager;
 import org.apache.axis2.util.UUIDGenerator;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.ws.commons.om.OMElement;
 import org.apache.wsdl.WSDLConstants;
 
@@ -336,12 +334,10 @@
         addReferenceParameters(mc);
         // ship it out
         AxisEngine engine = new AxisEngine(cc);
-        if (block) {
-            engine.send(mc);
-        } else {
-            sc.getConfigurationContext().getThreadPool().execute(
-                    new FireAndForgetInvocationWorker(mc, engine));
+        if (!block) {
+            mc.setProperty(MessageContext.TRANSPORT_NON_BLOCKING, Boolean.TRUE);
         }
+        engine.send(mc);
         // all done
         completed = true;
     }
@@ -370,26 +366,4 @@
         }
     }
 
-    /**
-     * This class is the workhorse for a non-blocking invocation that uses a two
-     * way transport.
-     */
-    private class FireAndForgetInvocationWorker implements Runnable {
-        private Log log = LogFactory.getLog(getClass());
-        private MessageContext msgctx;
-        private AxisEngine axisEngine;
-
-        public FireAndForgetInvocationWorker(MessageContext msgctx, AxisEngine axisEngine)
{
-            this.msgctx = msgctx;
-            this.axisEngine = axisEngine;
-        }
-
-        public void run() {
-            try {
-                axisEngine.send(msgctx);
-            } catch (Exception e) {
-                log.info(e.getMessage());
-            }
-        }
-    }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java?rev=383492&r1=383491&r2=383492&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
Mon Mar  6 00:12:49 2006
@@ -248,16 +248,16 @@
     private void extractFaultInformationFromMessageContext(MessageContext context, SOAPFault
fault,
                                                            Throwable e) {
         SOAPProcessingException soapException = null;
-        String soapNamespaceURI;
-
-        // get the current SOAP version
-        if (!context.isSOAP11()) {
-
-            // defaulting to SOAP 1.2
-            soapNamespaceURI = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
-        } else {
-            soapNamespaceURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
-        }
+//        String soapNamespaceURI;
+//
+//        // get the current SOAP version
+//        if (!context.isSOAP11()) {
+//
+//            // defaulting to SOAP 1.2
+//            soapNamespaceURI = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+//        } else {
+//            soapNamespaceURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+//        }
 
         if (e instanceof SOAPProcessingException) {
             soapException = (SOAPProcessingException) e;
@@ -272,7 +272,7 @@
         Object faultCode = context.getProperty(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME);
         String soapFaultCode = "";
 
-        Throwable exception = null;
+        Throwable exception;
         if (faultCode != null) {
             fault.setCode((SOAPFaultCode) faultCode);
         } else if (soapException != null) {
@@ -505,7 +505,17 @@
             TransportOutDescription transportOut = msgContext.getTransportOut();
             TransportSender sender = transportOut.getSender();
 
-            sender.invoke(msgContext);
+            // This boolean property only used in client side fireAndForget invocation
+            //It will set a property into message context and if some one has set the
+            //property then transport sender will invoke in a diffrent thread
+            Object isTranportBlocking = msgContext.getProperty(
+                    MessageContext.TRANSPORT_NON_BLOCKING);
+            if (isTranportBlocking != null && ((Boolean) isTranportBlocking).booleanValue())
{
+                msgContext.getConfigurationContext().getThreadPool().execute(
+                        new TranportNonBlockingInvocationWorker(msgContext, sender));
+            } else {
+                sender.invoke(msgContext);
+            }
         }
     }
 
@@ -524,7 +534,7 @@
             ArrayList faultExecutionChain = axisOperation.getPhasesOutFaultFlow();
 
             msgContext.setExecutionChain((ArrayList) faultExecutionChain.clone());
-            msgContext.setFLOW(MessageContext.OUT_FLOW);
+            msgContext.setFLOW(MessageContext.OUT_FAULT_FLOW);
             invoke(msgContext);
         }
 
@@ -546,5 +556,28 @@
         return SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapNamespace.getName())
                 ? SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX + ":" + SOAP12Constants.FAULT_CODE_SENDER
                 : SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX + ":" + SOAP11Constants.FAULT_CODE_SENDER;
+    }
+
+    /**
+     * This class is the workhorse for a non-blocking invocation that uses a two
+     * way transport.
+     */
+    private class TranportNonBlockingInvocationWorker implements Runnable {
+        private Log log = LogFactory.getLog(getClass());
+        private MessageContext msgctx;
+        private TransportSender sender;
+
+        public TranportNonBlockingInvocationWorker(MessageContext msgctx, TransportSender
sender) {
+            this.msgctx = msgctx;
+            this.sender = sender;
+        }
+
+        public void run() {
+            try {
+                sender.invoke(msgctx);
+            } catch (Exception e) {
+                log.info(e.getMessage());
+            }
+        }
     }
 }



Mime
View raw message