tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
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
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Konstantin,

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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk4u6AQACgkQ9CaO5/Lv0PD6cACfW4BS55+FtwpK3ZonNjOuvfPV
v+MAn3iCTpTSI+FOBkgdI9UOZD4YvsM6
=oazD
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message