Author: scheu
Date: Sun Jul 27 06:47:41 2008
New Revision: 680107

URL: http://svn.apache.org/viewvc?rev=680107&view=rev
Log:
Quick Fix: Only calculate the runtime threshold if this is a non-soap part.  
SOAP Parts are always stored in memory. 
Also corrected a typo in the getHeader code.

Modified:
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/impl/PartFactory.java

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/impl/PartFactory.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/impl/PartFactory.java?rev=680107&r1=680106&r2=680107&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/impl/PartFactory.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/impl/PartFactory.java
 Sun Jul 27 06:47:41 2008
@@ -102,14 +102,20 @@
                 // thrashing while reading from the HTTP InputStream.  
                 // Allowing fewer threads reduces the thrashing.  And when the 
remaining threads
                 // are notified their input (chunked) data is available.
-                synchronized(semifore) {
-                    if (inflight >= INFLIGHT_MAX) {
-                        semifore.wait();
+                // 
+                // Note: SOAPParts are at the beginning of the message and 
much smaller than attachments,
+                // so don't wait on soap parts.
+                if (!isSOAPPart) {
+                    synchronized(semifore) {
+                        if (inflight >= INFLIGHT_MAX) {
+                            semifore.wait();
+                        }
+                        inflight++;
                     }
-                    inflight++;
                 }
-                if (thresholdSize > 0) {
-                    // Get new threshold based on the current available memory 
in the runtime
+                // Get new threshold based on the current available memory in 
the runtime.
+                // We only use the thresholds for non-soap parts.
+                if (!isSOAPPart && thresholdSize > 0) {     
                     thresholdSize = getRuntimeThreshold(thresholdSize, 
inflight);
                 }
 
@@ -152,9 +158,11 @@
 
                 } 
             } finally {
-                synchronized(semifore) {
-                    semifore.notify();
-                    inflight--;
+                if (!isSOAPPart) {
+                    synchronized(semifore) {
+                        semifore.notify();
+                        inflight--;
+                    }
                 }
             }
 
@@ -234,7 +242,7 @@
                     } else {
                         
                         // Semicolon is a continuation character
-                        String check = headers.toString().trim();
+                        String check = sb.toString().trim();
                         if (!check.endsWith(";")) {
                             // now parse and add the header String
                             readHeader(sb, headers);


Reply via email to