Author: nthaker
Date: Fri Nov  5 15:33:41 2010
New Revision: 1031629

URL: http://svn.apache.org/viewvc?rev=1031629&view=rev
Log:
This is a performance improvement change. This performance change calculated 
MTOM Threshold values only when JAX-WS runtime detects that application is 
going to send/receive MTOM attachments.

The code contribution for this change is provided by Doug Larson of IBM.

Modified:
    
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
    
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/http/SOAPMessageFormatter.java

Modified: 
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java?rev=1031629&r1=1031628&r2=1031629&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
 Fri Nov  5 15:33:41 2010
@@ -525,14 +525,15 @@ public class TransportUtils {
            }
 
                Attachments attachments = msgContext.getAttachmentMap();
-               LifecycleManager lcm = 
(LifecycleManager)msgContext.getRootContext().getAxisConfiguration().getParameterValue(DeploymentConstants.ATTACHMENTS_LIFECYCLE_MANAGER);
+
            if (attachments != null) {
                // Get the list of Content IDs for the attachments...but does 
not try to pull the stream for new attachments.
                // (Pulling the stream for new attachments will probably 
fail...the stream is probably closed)
                List keys = attachments.getContentIDList();
-               if (keys != null) {
+               if (keys != null && keys.size() > 0) {
                        String key = null;
                        File file = null;
+                          LifecycleManager lcm = 
(LifecycleManager)msgContext.getRootContext().getAxisConfiguration().getParameterValue(DeploymentConstants.ATTACHMENTS_LIFECYCLE_MANAGER);
                            
                        DataSource dataSource = null;
                    for (int i = 0; i < keys.size(); i++) {
                        try {

Modified: 
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/http/SOAPMessageFormatter.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/http/SOAPMessageFormatter.java?rev=1031629&r1=1031628&r2=1031629&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/http/SOAPMessageFormatter.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/http/SOAPMessageFormatter.java
 Fri Nov  5 15:33:41 2010
@@ -55,14 +55,15 @@ public class SOAPMessageFormatter implem
         }
         OMElement element = msgCtxt.getEnvelope();
         
-        int optimizedThreshold = Utils.getMtomThreshold(msgCtxt);       
-        if(optimizedThreshold > 0){
-               if(log.isDebugEnabled()){
-                       log.debug("Setting MTOM optimized Threshold Value on 
OMOutputFormat");
-               }
-               format.setOptimizedThreshold(optimizedThreshold);
-        }              
-
+        if (msgCtxt.isDoingMTOM()) {           
+            int optimizedThreshold = Utils.getMtomThreshold(msgCtxt);       
+            if(optimizedThreshold > 0){
+               if(log.isDebugEnabled()){
+                       log.debug("Setting MTOM optimized Threshold Value on 
OMOutputFormat");
+               }
+               format.setOptimizedThreshold(optimizedThreshold);
+            }          
+        }
         try {
             if (!(format.isOptimized()) && format.isDoingSWA()) {
                 // Write the SOAPBody to an output stream


Reply via email to