users@grizzly.java.net

Re: HTTP server with server-side push (COMET)

From: Evgeny Shepelyuk <eshepelyuk_at_gmail.com>
Date: Thu, 06 Aug 2009 18:49:04 +0300

Hello Alexey,

Finally i was able to create Comet based application and seems it's
working perfectly :))
I had to set -Xms -Xms parameters to not crash.
Here's the code. I still have some questions though :)

1. Is this code really required ? Since clients of my application don't
send any data there's no need to read from stream ?
How can i decrese amoutn of resources for this ?

                gws.getSelectorThread().setSelectorReadThreadsCount(5);
                gws.getSelectorThread().setCoreThreads(20);
                gws.getSelectorThread().setMaxThreads(100);

2. is onEvent is correctly written ? maybe there's no need in non-blocking
write ?

3. is this code required for non-blockign write ?

                gws.getSelectorThread().setAsyncHttpWriteEnabled(true);

4. how to handle client disconnection correctly. This should happen in
onInterrupt() method ?
Should i remove CometHandler manually or its is removed autmatically ?

5. What is the meaning of calling CometHandler.attach() for my case ? I
found it unused.
I've taken this approach from examples that are based on sservlet container

Sorry for too much questions, i wil be very appreciated if you can asnwer
some of them or give me good sources to investigate by myself.
I was unable to find good example of using comet with non-browser/non-ajax
streaming. So that's why im asking too much :)

-- 
Regards,
Evgeny Shepelyuk