You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2004/11/16 17:36:37 UTC

cvs commit: ws-axis/java/src/org/apache/axis/message NodeImpl.java NodeListImpl.java

dims        2004/11/16 08:36:37

  Modified:    java/src/org/apache/axis/encoding DeserializerImpl.java
               java/src/org/apache/axis/encoding/ser
                        SimpleDeserializer.java SimpleListDeserializer.java
               java/src/org/apache/axis/message NodeImpl.java
                        NodeListImpl.java
  Log:
  Fix for Perf problems from Archit Shah (http://marc.theaimsgroup.com/?l=axis-dev&m=110061913205350&w=2)
  
  Revision  Changes    Path
  1.44      +3 -9      ws-axis/java/src/org/apache/axis/encoding/DeserializerImpl.java
  
  Index: DeserializerImpl.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/DeserializerImpl.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- DeserializerImpl.java	7 Sep 2004 09:34:48 -0000	1.43
  +++ DeserializerImpl.java	16 Nov 2004 16:36:36 -0000	1.44
  @@ -33,7 +33,6 @@
   
   import javax.xml.namespace.QName;
   import java.io.StringWriter;
  -import java.util.Enumeration;
   import java.util.HashSet;
   import java.util.Vector;
   
  @@ -186,7 +185,6 @@
        */
       public void removeValueTargets() {
           if (targets != null) {
  -            targets.clear();
               targets = null;
           }
       }
  @@ -210,10 +208,7 @@
               targets = new Vector();
           }
           
  -        Enumeration e = other.getValueTargets().elements();
  -        while (e.hasMoreElements()) {
  -            targets.addElement(e.nextElement());
  -        }
  +        targets.addAll(other.getValueTargets());
           other.removeValueTargets();
       }
       
  @@ -249,9 +244,8 @@
       {
           if (componentsReady()) {            
               if (targets != null) {
  -                Enumeration e = targets.elements();
  -                while (e.hasMoreElements()) {
  -                    Target target = (Target)e.nextElement();
  +                for (int i = 0; i < targets.size(); i++) {
  +                    Target target = (Target) targets.get(i);
                       target.set(value);
                       if (debugEnabled) {
                           log.debug(Messages.getMessage("setValueInTarget00",
  
  
  
  1.41      +0 -12     ws-axis/java/src/org/apache/axis/encoding/ser/SimpleDeserializer.java
  
  Index: SimpleDeserializer.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/ser/SimpleDeserializer.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- SimpleDeserializer.java	15 Nov 2004 07:13:11 -0000	1.40
  +++ SimpleDeserializer.java	16 Nov 2004 16:36:37 -0000	1.41
  @@ -122,18 +122,6 @@
           isEnded = false; // Indicate the end of element not yet called
       }
       
  -    /**
  -     * Remove the Value Targets of the Deserializer.
  -     * Simple deserializers may be re-used, so don't
  -     * nullify the vector.
  -     */
  -    public void removeValueTargets() {
  -        if (targets != null) {
  -            targets.clear();
  -            // targets = null;
  -        }
  -    }
  -    
       /** 
        * The Factory calls setConstructor.
        */
  
  
  
  1.5       +0 -12     ws-axis/java/src/org/apache/axis/encoding/ser/SimpleListDeserializer.java
  
  Index: SimpleListDeserializer.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/ser/SimpleListDeserializer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SimpleListDeserializer.java	2 Sep 2004 12:15:59 -0000	1.4
  +++ SimpleListDeserializer.java	16 Nov 2004 16:36:37 -0000	1.5
  @@ -92,18 +92,6 @@
       }
   
       /**
  -     * Remove the Value Targets of the Deserializer.
  -     * Simple deserializers may be re-used, so don't
  -     * nullify the vector.
  -     */
  -    public void removeValueTargets() {
  -        if (targets != null) {
  -            targets.clear();
  -            // targets = null;
  -        }
  -    }
  -
  -    /**
        * The Factory calls setConstructor.
        */
       public void setConstructor(Constructor c)
  
  
  
  1.9       +5 -2      ws-axis/java/src/org/apache/axis/message/NodeImpl.java
  
  Index: NodeImpl.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/message/NodeImpl.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- NodeImpl.java	11 Nov 2004 05:29:37 -0000	1.8
  +++ NodeImpl.java	16 Nov 2004 16:36:37 -0000	1.9
  @@ -427,8 +427,11 @@
        * nodes.
        */
       public NodeList getChildNodes() {
  -        initializeChildren();
  -        return new NodeListImpl(children);
  +        if (children == null) {
  +            return NodeListImpl.EMPTY_NODELIST;
  +        } else {
  +            return new NodeListImpl(children);
  +        }
       }
   
       /**
  
  
  
  1.5       +10 -9     ws-axis/java/src/org/apache/axis/message/NodeListImpl.java
  
  Index: NodeListImpl.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/message/NodeListImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NodeListImpl.java	27 Jun 2004 12:28:31 -0000	1.4
  +++ NodeListImpl.java	16 Nov 2004 16:36:37 -0000	1.5
  @@ -19,8 +19,10 @@
   import org.w3c.dom.Node;
   import org.w3c.dom.NodeList;
   
  +import java.util.ArrayList;
   import java.util.Collection;
  -import java.util.Vector;
  +import java.util.Collections;
  +import java.util.List;
   
   /**
    * A simple implementation for Nodelist Support in AXIS
  @@ -30,22 +32,21 @@
    */
   
   class NodeListImpl implements NodeList {
  -    Vector mNodes;
  +    List mNodes;
  +
  +    public static final NodeList EMPTY_NODELIST = new NodeListImpl(Collections.EMPTY_LIST);
   
       /**
        * Constructor and Setter is intensionally made package access only.
        *  
        */
       NodeListImpl() {
  -        mNodes = new Vector();
  -    }
  -
  -    NodeListImpl(Vector nodes) {
  -        mNodes = nodes;
  +        mNodes = new ArrayList();
       }
   
  -    NodeListImpl(Collection nodes) {
  -        mNodes = new Vector(nodes);
  +    NodeListImpl(List nodes) {
  +        this();
  +        mNodes.addAll(nodes);
       }
   
       void addNode(org.w3c.dom.Node node) {