You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Dan Adams <da...@ifactory.com> on 2007/05/10 22:43:26 UTC

[T4] Must/should close output stream in engine services?

When you have an engine service that serves up binary files, for
instance, and calls WebResponse.getOutputStream() should it or should it
not close the output stream when it's done with it?

-- 
Dan Adams
Senior Software Engineer
Interactive Factory
617.235.5857


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


Re: [T4] Must/should close output stream in engine services?

Posted by Dan Adams <da...@ifactory.com>.
But when you call WebResponse.getOutputStream() you aren't creating it
directly and the javadoc doesn't specify who's responsibility it is to
close it.

The only problem I've ever run into on this was that I had an image
output stream that wrapped the stream returned by getOutputStream(). I
neglected to close the wrapping outputstream so when it garbage
collected later it would close itself and the underlying stream which
was bad because the underlying outputstream was a shared instance
provided by tomcat. Caused some very weird behavior.

On Fri, 2007-05-11 at 19:04 -0400, Jesse Kuhnert wrote:
> It should.  Anything that opens an IO stream in any java application should
> always try to close it as soon as possible unless you are using it as some
> kind of continuous stream of communication.  (on unix based systems it will
> steal file handles )
> 
> On 5/10/07, Dan Adams <da...@ifactory.com> wrote:
> >
> > When you have an engine service that serves up binary files, for
> > instance, and calls WebResponse.getOutputStream() should it or should it
> > not close the output stream when it's done with it?
> >
> > --
> > Dan Adams
> > Senior Software Engineer
> > Interactive Factory
> > 617.235.5857
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> 
> 
-- 
Dan Adams
Senior Software Engineer
Interactive Factory
617.235.5857


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


Re: [T4] Must/should close output stream in engine services?

Posted by Jesse Kuhnert <jk...@gmail.com>.
It should.  Anything that opens an IO stream in any java application should
always try to close it as soon as possible unless you are using it as some
kind of continuous stream of communication.  (on unix based systems it will
steal file handles )

On 5/10/07, Dan Adams <da...@ifactory.com> wrote:
>
> When you have an engine service that serves up binary files, for
> instance, and calls WebResponse.getOutputStream() should it or should it
> not close the output stream when it's done with it?
>
> --
> Dan Adams
> Senior Software Engineer
> Interactive Factory
> 617.235.5857
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com