tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filip Hanik - Dev Lists <devli...@hanik.com>
Subject Re: Tomcat Comet and persistent connections
Date Mon, 10 Aug 2009 13:30:59 GMT
after step 4 you should call close on the CometEvent.
this way, tomcat should recycle all objects and be ready for a new request.
you see, otherwise the next request would become a simple READ event 
(where the HTTP headers would become the body)
in your case, the reason you're getting an error and the connection is 
closed, is cause the 2nd request, that tomcat thinks is the body exceeds 
the content length, and marks it as an error

Filip

On 08/10/2009 02:06 AM, Dmitry Murashenkov wrote:
> Hello,
>
> we are developing a webapp and trying to use Tomcat Comet to allow asynchronous processing
of requests. Somehow we have problems with persistent connections when using Comet (possibly
due to some API misusage).
>
> So, the short question is: does Tomcat Comet servlets support persistent connections?
>
> Here is test case description:
>
> 1. Client opens connection to server and sends request.
> 2. Servlet processes BEGIN and then several READ events, extracting all content.
> 3. When all content is received (number of bytes received is equal to the value in Content-Length
header) processing of request is passed to another ResponseSender thread (HttpServletRequest
and HttpServletResponse objects from CometEvent are put into queue and ResponseSender thread
iterates over this queue and sends responses).
> 4. ResponseSender thread writes response and performs flushBuffer().
> 5. Client receives response.
> 6. Client sends another request using the same connection.
> 7. END event arrives to servlet and it must be closed (otherwise it will arrived again
in the infinite loop).
> 8. Closing END event results in closure of connection to server and second request is
lost.
>
> It seems that each request in Comet must end with calling close() on the END event which
will close connection to the client and will prevent client from submiting more than one request
via this connection (using connection as a presistent).
>
> Is this behaviour expected? Is there a way to use persistent connections with async servlets
based on Tomcat Comet architecture?
>
> Dmitry Murashenkov | Research&  Development | +7 495 926 9347 ext 1689 | www.NetCracker.com>>>>
 Transforming the Service LayerTM
>
>
>
> The information transmitted herein is intended only for the person or entity to which
it is addressed and may contain confidential, proprietary and/or privileged material. Any
review, retransmission, dissemination or other use of, or taking of any action in reliance
upon, this information by persons or entities other than the intended recipient is prohibited.
If you received this in error, please contact the sender and delete the material from any
computer.
>
>
>    


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


Mime
View raw message