tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: AJP-APR failures on Tomcat 7.0.16 with ISAPI Redirector 1.2.32
Date Tue, 26 Jul 2011 16:15:00 GMT
Hash: SHA1


On 7/14/2011 8:41 AM, eurotrans-Verlag wrote:
> An alternative that I could imagine, would be to create a class
> (that has a boolean flag) which extends OutputStream, and decorates
> another OutputStream that is given to the class in the constructor
> (that would be the OutputStream from the servlet's response). This
> class would pass all calls to it to the other OutputStream (as long
> as the flag is true), and as soon as close() or another special
> method is called, it sets the flag to false, which causes all other
> methods to do nothing (or throw an IOException). That way, Tomcat's
> OutputStream would also be protected from future calls from the
> ImageIO.

You should also null-out the reference to Tomcat's output stream.

This would allow you to "leak" your own decorator objects but not
interfere with Tomcat's ability to do it's own object management.

Such a class would definitely be useful to post on the Wiki.

> However, it seems also a bit strange to me that Tomcat is recycling 
> OutputStreams, because in my understanding, once an OutputStream is 
> closed, it should be impossible to do any further write() calls to 
> it.

True, but Tomcat tries to avoid as much memory churn as possible, and
re-uses objects whenever possible. You can change this behavior with
configuration if you want.

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message