On 29 Aug 2010, at 06:51, Paulo Silveira <paulo.silve...@gmail.com> wrote:

> Hello
>
> I am starting async requests inside a  asyncSupported=true servlet.
> After that, sometimes an event occurs and I need to dispatch a small
> message to each client. For this purpose I use a executor that will
> send this message to each client in an obvious way:
>
>    for (final AsyncContext ctx : clients) {
>        executors.execute(new Runnable() {
>            public void run() {
>                try {
>                        if (ctx.getResponse().isCommitted()) {
>                                System.out.println("wow! why?");
>                                return;
>                        }
>
>                        PrintWriter writer = ctx.getResponse().getWriter();
>                        writer    .println(message);
>                        writer.flush();
>
>                        } catch (IOException e) {
>                            e.printStackTrace();
>                        }
>                    }
>
>                });
>        }
>
> After the firs message being sent for the client,
> getResponse().isCommited is true. If I try to send the second message,
> I will get an EOF exception.

Exactly which version of Tomcat 7.0.x?


p


>
> Thanks
> --
> Paulo Silveira
> Caelum | Ensino e Inovação
> www.caelum.com.br
> www.arquiteturajava.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>

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

Reply via email to