Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Re: Tomcat 5 is not generating IOException when connection closes

Remy Maucherat

2004-01-08

Replies:

Vitor Buitoni wrote:
> What do you mean by ok?
>
> As far as i can see, the connection closes and writing data to the
> OutputStream should generate an IOException, but this isn't happening...
> :-(
> The problem is that my servlet is inside a loop, and needs to know when
> the client closes the connection, so it can exit the loop and properly
> close the running thread and liberate memory and cpu resources.
>
> If you say it's ok, it means that tomcat really buffers the data and
> only generate the IOException when this buffer is full, and that this
> behavior is ok.
> Is there any way i can control this tomcat's behaviour, like reduce the
> size of the buffer? Or even disable this buffer? (better)
>
> thanks!
> Vitor
> P.S.: (to avoid confusion) The original message was posted by Paulo, but
> i'm working with him.

There was indeed something wrong. This has been fixed.

>>>               out.write(s.getBytes(), 0, s.length());

Writing that kind of code is bad ! You should likely use a PrintWriter
instead and use checkError.

--
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
R�my Maucherat
Senior Developer & Consultant
JBoss Group (Europe) S�RL
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)



©2008 junlu.com - Jax Systems, LLC, U.S.A.