users@grizzly.java.net

Re: Servlet blocking??

From: César Fernando Henriques <fuzzball_at_alttab.com.ar>
Date: Thu, 21 May 2009 14:02:26 -0300

Thabks, I have added your code but still have the same problem... I
believe I'm missing something big...;-)

On Thu, May 21, 2009 at 1:52 PM, Survivant 00 <survivant00_at_gmail.com> wrote:
> I never did comet stuff yet, but here a snippet that will enable comet.
>
>
> // comet
>             if(cometEnabled){
>                 SelectorThread st = ws.getSelectorThread();
>
>                 AsyncHandler asyncHandler = new DefaultAsyncHandler();
>                 asyncHandler.addAsyncFilter(new CometAsyncFilter());
>                 st.setAsyncHandler(asyncHandler);
>
>                 st.setEnableAsyncExecution(true);
>             }
>
>
>
>
>
> 2009/5/21 César Fernando Henriques <cesar_at_alttab.com.ar>
>>
>> Hi guys, I'm runnign the following code and something is wrong, the
>> servlet is blocking so I just can serve one client at time. Is that
>> supposed to work in that way?
>>
>> Sorry if this is a silly question.. I'm new to Grizzly.
>>
>>
>>         GrizzlyWebServer server = new GrizzlyWebServer(80);
>>
>>         server.addAsyncFilter(new CometAsyncFilter());
>>
>>         server.addGrizzlyAdapter(new ServletAdapter(new MyServlet()),
>> new String[]{"/"});
>>
>>         server.addGrizzlyAdapter(new GrizzlyAdapter() {
>>
>>             @Override
>>             public void service(GrizzlyRequest arg0, GrizzlyResponse arg1)
>> {
>>
>>                 CometEngine cometEngine = CometEngine.getEngine();
>>                 CometContext cometContext =
>> cometEngine.getCometContext("caca");
>>
>>                 try {
>>                     cometContext.notify("Chatter test has joined.");
>>                 } catch (IOException e) {
>>                     // TODO Auto-generated catch block
>>                     e.printStackTrace();
>>                 }
>>             }
>>         }, new String[] { "/test" });
>>
>>         try {
>>             server.start();
>>         } catch (IOException e) {
>>             // TODO Auto-generated catch block
>>             e.printStackTrace();
>>         }
>>
>>
>> Regards.-
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>
>
>