users@grizzly.java.net

Servlet blocking??

From: César Fernando Henriques <cesar_at_alttab.com.ar>
Date: Thu, 21 May 2009 13:45:32 -0300

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.-