You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Joe Biron <jo...@josephbiron.com> on 2011/01/03 22:54:42 UTC

Handling Comet Timeouts with CometProcessor

Hello,

I've been making great progress with CometProcessor on Tomcat 6.0.29.
I have a question about handling timeouts (and I did review this
thread: http://www.mail-archive.com/users@tomcat.apache.org/msg55616.html).

I want my clients to connect and stay connected for a very long time,
but I do need to have my server time the connections out periodically.

When I request.setAttribute("org.apache.tomcat.comet.timeout",
timeout), I do indeed receive a CometEvent.EventType.ERROR, but I can
find no way to gracefully tell the client that everything is OK and I
just want them to back off for a while then reconnect.

When I do this:

...
response.sendError(HttpServletResponse.SC_REQUEST_TIMEOUT, "Timed out.
Please reconnect");
response.flushBuffer();
event.close();
...

the client does not receive the response. They only sense an
unceremonious connection close - which, if through routers, may take
quite some time to be detected.

How can I hook into the timeout to send the client a short response
before connection close?

Is there a better way to do this? Should my application handle these
timeouts, and use the comet.timeout as a longer safety net?

Much appreciated.

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


Re: Handling Comet Timeouts with CometProcessor

Posted by Mark Thomas <ma...@apache.org>.
On 04/01/2011 10:34, Joe Biron wrote:
>>> Is there a better way to do this? Should my application handle these
>>> timeouts, and use the comet.timeout as a longer safety net?
>>
>> That sounds like the way to do it to me.
>>
>> Mark
> 
> Thanks. It would be great if the comet event "pump" gave me a
> PRE_TIMEOUT subevent, but at least I know what I need to do.

Put an enhancement request in bugzilla. I can't promise it will ever get
implemented but if is there at least the request won't get lost.

Mark

PS Enhancement requests with patches tend to get look at sooner ;)

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


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


Re: Handling Comet Timeouts with CometProcessor

Posted by Joe Biron <jo...@josephbiron.com>.
>> Is there a better way to do this? Should my application handle these
>> timeouts, and use the comet.timeout as a longer safety net?
>
> That sounds like the way to do it to me.
>
> Mark

Thanks. It would be great if the comet event "pump" gave me a
PRE_TIMEOUT subevent, but at least I know what I need to do.

Joe

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


Re: Handling Comet Timeouts with CometProcessor

Posted by Mark Thomas <ma...@apache.org>.
On 03/01/2011 21:54, Joe Biron wrote:
> Hello,
> 
> I've been making great progress with CometProcessor on Tomcat 6.0.29.
> I have a question about handling timeouts (and I did review this
> thread: http://www.mail-archive.com/users@tomcat.apache.org/msg55616.html).
> 
> I want my clients to connect and stay connected for a very long time,
> but I do need to have my server time the connections out periodically.
> 
> When I request.setAttribute("org.apache.tomcat.comet.timeout",
> timeout), I do indeed receive a CometEvent.EventType.ERROR, but I can
> find no way to gracefully tell the client that everything is OK and I
> just want them to back off for a while then reconnect.
> 
> When I do this:
> 
> ...
> response.sendError(HttpServletResponse.SC_REQUEST_TIMEOUT, "Timed out.
> Please reconnect");
> response.flushBuffer();
> event.close();
> ...
> 
> the client does not receive the response. They only sense an
> unceremonious connection close - which, if through routers, may take
> quite some time to be detected.
> 
> How can I hook into the timeout to send the client a short response
> before connection close?

I don't believe (Filip or someone else who knows Comet much better than
I do will correct me if I am wrong) the Comet API supports that.

> Is there a better way to do this? Should my application handle these
> timeouts, and use the comet.timeout as a longer safety net?

That sounds like the way to do it to me.

Mark

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