Archive for July 29th, 2007

Ridiculous mod_jk Problem with Flush Method

Sunday, July 29th, 2007

I am writing Java2Script’s Google Talk, and it uses a mode of continuation (also known as “Comet” application). In order to implement continuum data transfer between browser and server ( Tomcat in the backend ), I kept the HTTP connection blocked waiting for data to be available. In the middle, Apache httpd server is used and mod_jk is used to connect the two server.

But I met a ridiculous problem between servlet container and http server. When the browser is assigned to connect servlet directly, it can obtain data from the connection, but it can not obtain a bit when it is piped through Apache httpd server.

I tried to add “Transfer-Encoding: chunked” or “Content-length: 0″ but with no helps. And I modified jk.conf with “JkOptions +FlushPackets”, still with no helps. Finally, I remove a line of “writer.flush();” from my servlet source, and things all went correctly.

The line of “writer.flush();” was located in the the line when there is no data written to the response. And I considered that when there are no data in the response, calling flush method will hang mod_jk connector up. And the whole later data transfer will be disturbed.

More details about mod_jk, I recommend you to read “Tunning apache and tomcat for web 2.0 comet application“.

Update:
Finally I found out that “JkOptions +FlushPackets” works for me. #flush method problem is a fake problem. Only after I restart both Tomcat and Apache server do “JkOptions +FlushPackets” begin to work.

Busy Days on Java2Script Google Talk

Sunday, July 29th, 2007

Ya, these days were very busy.

I had spent more than a month on rewriting Java2Script Google Talk. And today, it was almost finished. You can check it out right now.

More works are required to make it robuster and faster. Maybe Java2Script Google Talk will be publicly released in the next week.

And next release of Java2Script is on the way too. It will be a 1.0.0 RC release. Four months was a long long time since last release.