axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hemap...@apache.org
Subject svn commit: r149403 - in webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis: impl/llom/OMElementImpl.java impl/llom/factory/OMLinkedListImplFactory.java impl/receivers/InOutSyncReceiver.java transport/AbstractTransportSender.java
Date Tue, 01 Feb 2005 15:07:42 GMT
Author: hemapani
Date: Tue Feb  1 07:07:39 2005
New Revision: 149403

URL: http://svn.apache.org/viewcvs?view=rev&rev=149403
Log:
fix the pooling

Modified:
    webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java
    webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/factory/OMLinkedListImplFactory.java
    webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/receivers/InOutSyncReceiver.java
    webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/AbstractTransportSender.java

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java?view=diff&r1=149402&r2=149403
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java
Tue Feb  1 07:07:39 2005
@@ -58,9 +58,15 @@
     public void free(){
             this.namespaces.clear();
             this.attributes.clear();
-            firstChild.free();
+            if(firstChild != null){
+				firstChild.free();
+            }
+            
             OMFactory.newInstance().free(this);
-            nextSibling.free();
+            if(nextSibling != null){
+				nextSibling.free();	
+            }
+            
         }
 
     public void init(String localName, OMNamespace ns, OMElement parent, OMXMLParserWrapper
builder) {

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/factory/OMLinkedListImplFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/factory/OMLinkedListImplFactory.java?view=diff&r1=149402&r2=149403
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/factory/OMLinkedListImplFactory.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/factory/OMLinkedListImplFactory.java
Tue Feb  1 07:07:39 2005
@@ -3,9 +3,7 @@
 import java.util.Stack;
 
 import org.apache.axis.impl.llom.OMElementImpl;
-import org.apache.axis.impl.llom.OMNamedNodeImpl;
 import org.apache.axis.impl.llom.OMNamespaceImpl;
-import org.apache.axis.impl.llom.OMNodeImpl;
 import org.apache.axis.impl.llom.OMTextImpl;
 import org.apache.axis.impl.llom.SOAPBodyImpl;
 import org.apache.axis.impl.llom.SOAPEnvelopeImpl;
@@ -15,7 +13,6 @@
 import org.apache.axis.om.OMConstants;
 import org.apache.axis.om.OMElement;
 import org.apache.axis.om.OMFactory;
-import org.apache.axis.om.OMNamedNode;
 import org.apache.axis.om.OMNamespace;
 import org.apache.axis.om.OMNode;
 import org.apache.axis.om.OMText;
@@ -43,16 +40,43 @@
  * <p/>
  */
 public class OMLinkedListImplFactory extends OMFactory {
+	public static final int MAX_TO_POOL = 100;
 	private Stack elements = new Stack();
 	private Stack textNodes = new Stack();
+
+	private OMElementImpl findElement(){
+		OMElementImpl element = null;
+		if(elements.isEmpty()){
+			element = new OMElementImpl();
+		}else{
+			element = (OMElementImpl)elements.pop();
+		}
+		return element;
+	}
+
+	private OMTextImpl findText(){
+		OMTextImpl text = null;
+		if(elements.isEmpty()){
+			text = new OMTextImpl();
+		}else{
+			text = (OMTextImpl)textNodes.pop();
+		}
+		return text;
+	}
 	
 	public void free(OMNode node){
 		int type = node.getType();
 		switch(type){
 			case OMNode.ELEMENT_NODE:
-			elements.push(node);
+				if(elements.size() < MAX_TO_POOL){
+					elements.push(node);				
+				}
+			break;
 			case OMNode.TEXT_NODE:
-			textNodes.push(node);
+			if(textNodes.size() < MAX_TO_POOL){
+				textNodes.push(node);
+			}
+			break;
 			default:
 			//NOOP;
 			
@@ -61,19 +85,13 @@
 
 
     public OMElement createOMElement(String localName, OMNamespace ns) {
-		OMElementImpl element = null;
-		if(elements.isEmpty()){
-			element = new OMElementImpl();
-		}
+		OMElementImpl element = findElement();
 		element.init(localName, ns);
 		return element;
     }
 
     public OMElement createOMElement(String localName, OMNamespace ns, OMElement parent,
OMXMLParserWrapper builder) {
-    	OMElementImpl element = null;
-    	if(elements.isEmpty()){
-    		element = new OMElementImpl();
-    	}
+    	OMElementImpl element = findElement();
         element.init(localName, ns, parent, builder);
         return element;
     }
@@ -95,19 +113,13 @@
 //    }
 
     public OMText createText(OMElement parent, String text) {
-		OMTextImpl textNode = null;
-		if(textNodes.isEmpty()){
-			textNode = new OMTextImpl();
-		}
+		OMTextImpl textNode = findText();
 		textNode.init(parent, text);
 		return textNode;
     }
 
     public OMText createText(String s) {
-		OMTextImpl textNode = null;
-		if(textNodes.isEmpty()){
-			textNode = new OMTextImpl();
-		}
+		OMTextImpl textNode = findText();
 		textNode.init(s);
 		return textNode;
     }

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/receivers/InOutSyncReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/receivers/InOutSyncReceiver.java?view=diff&r1=149402&r2=149403
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/receivers/InOutSyncReceiver.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/receivers/InOutSyncReceiver.java
Tue Feb  1 07:07:39 2005
@@ -51,6 +51,8 @@
 		Provider provider = msgContext.getService().getProvider();
 		log.info("start invoke the web service impl");
 		MessageContext outMsgContext = provider.invoke(msgContext);
+		msgContext.getEnvelope().free();
+		
 		log.info("Invoked the Web Servivces impl");
         Sender sender = new Sender();
         sender.send(msgContext);

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/AbstractTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/AbstractTransportSender.java?view=diff&r1=149402&r2=149403
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/AbstractTransportSender.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/AbstractTransportSender.java
Tue Feb  1 07:07:39 2005
@@ -16,6 +16,11 @@
 
 package org.apache.axis.transport;
 
+import java.io.OutputStream;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
 import org.apache.axis.addressing.EndpointReference;
 import org.apache.axis.context.MessageContext;
 import org.apache.axis.engine.AxisFault;
@@ -23,11 +28,6 @@
 import org.apache.axis.impl.handlers.AbstractHandler;
 import org.apache.axis.om.SOAPEnvelope;
 
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-import java.io.OutputStream;
-
 /**
  */
 public abstract class AbstractTransportSender extends AbstractHandler implements TransportSender
{
@@ -58,6 +58,7 @@
                 outputWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(out);
                 envelope.serialize(outputWriter,false);
                 outputWriter.flush();
+                envelope.free();
             } catch (Exception e) {
                 throw new AxisFault("Stream error",e);
             }



Mime
View raw message