cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davanum Srinivas <d...@yahoo.com>
Subject Re: [C2]: Patch for poolable FOPSerializer
Date Fri, 08 Dec 2000 12:08:19 GMT
Carsten,

1. Checked in your Fix for FOPSerializer.
2. Checked in 0.15 fop jar file.

Thanks,
dims

--- Carsten Ziegeler <cziegeler@sundn.de> wrote:
> Hello,
> 
> attached is a patch for the FOPSerializer which makes it poolable. 
> It also fixes a hook memory leak, as the old FOPSerializer was never 
> removed from the MessageHandler listener list.
> 
> I would also suggest to update to fop version to 0.15 as besides
> some other improvements the memory usage is much smaller.
> 
> Regards
> Carsten Ziegeler
> 
> Open Source Group              sunShine - Lighting up e:Business
> ================================================================
> Carsten Ziegeler, S&N AG, Klingenderstrasse 5, D-33100 Paderborn
> www.sundn.de                           mailto:cziegeler@sundn.de 
> ================================================================
> > Index: FOPSerializer.java
> ===================================================================
> RCS file:
> /home/cvspublic/xml-cocoon/src/org/apache/cocoon/serialization/Attic/FOPSerializer.java,v
> retrieving revision 1.1.2.7
> diff -u -r1.1.2.7 FOPSerializer.java
> --- FOPSerializer.java	2000/12/05 00:24:13	1.1.2.7
> +++ FOPSerializer.java	2000/12/08 09:49:08
> @@ -12,6 +12,7 @@
>  import java.io.OutputStream;
>  import java.io.PrintWriter;
>  
> +import org.apache.avalon.Poolable;
>  import org.apache.fop.apps.Driver;
>  import org.apache.fop.apps.FOPException;
>  import org.apache.fop.apps.Version;
> @@ -31,7 +32,7 @@
>   * @version CVS $Revision: 1.1.2.7 $ $Date: 2000/12/05 00:24:13 $
>   *
>   */
> -public class FOPSerializer extends AbstractSerializer implements MessageListener {
> +public class FOPSerializer extends AbstractSerializer implements MessageListener, Poolable
{
>  
>      /**
>       * The FOP driver
> @@ -39,9 +40,9 @@
>      private Driver driver = null;
>  
>      /**
> -     * Create the FOP driver
> +     * Set the <code>OutputStream</code> where the XML should be serialized.
>       */
> -    public FOPSerializer() {
> +    public void setOutputStream(OutputStream out) {
>          this.driver = new Driver();
>  
>          // the use of static resources sucks for servlet enviornments
> @@ -55,12 +56,6 @@
>          this.driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
>          this.driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping");
>          this.driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping");
> -    }
> -
> -    /**
> -     * Set the <code>OutputStream</code> where the XML should be serialized.
> -     */
> -    public void setOutputStream(OutputStream out) {
>          this.driver.setWriter(new PrintWriter(out));
>          this.setContentHandler(this.driver.getContentHandler());
>       }
> @@ -77,6 +72,9 @@
>              throw new SAXException (e);
>          } catch (FOPException e) {
>              throw new SAXException (e);
> +        } finally {
> +            driver = null;
> +            MessageHandler.removeListener(this);
>          }
>      }
>  
> 


=====
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI

__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/

Mime
View raw message