axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: ws-axis/java/src/org/apache/axis/utils XMLUtils.java
Date Mon, 19 Jul 2004 03:03:33 GMT
dims        2004/07/18 20:03:33

  Modified:    java/src/org/apache/axis AxisEngine.java
               java/src/org/apache/axis/utils XMLUtils.java
  Log:
  Fix for memory leaks (AXIS-1423). Flag to make parser reuse optional.
  
  Revision  Changes    Path
  1.115     +1 -0      ws-axis/java/src/org/apache/axis/AxisEngine.java
  
  Index: AxisEngine.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/AxisEngine.java,v
  retrieving revision 1.114
  retrieving revision 1.115
  diff -u -r1.114 -r1.115
  --- AxisEngine.java	20 Jun 2004 21:26:39 -0000	1.114
  +++ AxisEngine.java	19 Jul 2004 03:03:33 -0000	1.115
  @@ -67,6 +67,7 @@
       public static final String PROP_SOAP_ALLOWED_VERSION = "singleSOAPVersion";
       public static final String PROP_TWOD_ARRAY_ENCODING = "enable2DArrayEncoding";
       public static final String PROP_XML_ENCODING = "axis.xmlEncoding";
  +    public static final String PROP_XML_REUSE_SAX_PARSERS = "axis.xml.reuseParsers";
       public static final String PROP_BYTE_BUFFER_BACKING = "axis.byteBuffer.backing";
       public static final String PROP_BYTE_BUFFER_CACHE_INCREMENT = "axis.byteBuffer.cacheIncrement";
       public static final String PROP_BYTE_BUFFER_RESIDENT_MAX_SIZE = "axis.byteBuffer.residentMaxSize";
  
  
  
  1.96      +15 -2     ws-axis/java/src/org/apache/axis/utils/XMLUtils.java
  
  Index: XMLUtils.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/utils/XMLUtils.java,v
  retrieving revision 1.95
  retrieving revision 1.96
  diff -u -r1.95 -r1.96
  --- XMLUtils.java	17 Jul 2004 19:53:57 -0000	1.95
  +++ XMLUtils.java	19 Jul 2004 03:03:33 -0000	1.96
  @@ -21,6 +21,7 @@
   import org.apache.axis.InternalException;
   import org.apache.axis.Message;
   import org.apache.axis.MessageContext;
  +import org.apache.axis.AxisProperties;
   import org.apache.axis.components.encoding.XMLEncoder;
   import org.apache.axis.components.encoding.XMLEncoderFactory;
   import org.apache.axis.components.logger.LogFactory;
  @@ -87,9 +88,21 @@
       private static String EMPTY = "";
       private static ByteArrayInputStream bais = new ByteArrayInputStream(EMPTY.getBytes());
   
  +    protected static boolean enableParserReuse = false;
  +    
       static {
           // Initialize SAX Parser factory defaults
           initSAXFactory(null, true, false);
  +
  +        String value = AxisProperties.getProperty(AxisEngine.PROP_XML_REUSE_SAX_PARSERS,
  +                "" + false);
  +        if (value.equalsIgnoreCase("true") ||
  +                value.equals("1") ||
  +                value.equalsIgnoreCase("yes")) {
  +            enableParserReuse = true;
  +        } else {
  +            enableParserReuse = false;
  +        }
       }
   
       /** 
  @@ -200,7 +213,7 @@
        * @return a SAXParser instance.
        */
       public static synchronized SAXParser getSAXParser() {
  -        if(!saxParsers.empty()) {
  +        if(enableParserReuse && !saxParsers.empty()) {
               return (SAXParser )saxParsers.pop();
           }
   
  @@ -229,7 +242,7 @@
        * @param parser A SAX parser that is available for reuse
        */
       public static void releaseSAXParser(SAXParser parser) {
  -        if(!tryReset) return;
  +        if(!tryReset || !enableParserReuse) return;
   
           //Free up possible ref. held by past contenthandler.
           try{
  
  
  

Mime
View raw message