users@grizzly.java.net

Re: Connecting server to a client in an asynchronous way

From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
Date: Tue, 14 Jul 2009 11:01:53 +0200

Hi Alaska,

> I"m running the grizzly-nio-framework (v1.9.14) in a filter/
> protocolChain
> mode.
>
> I"m storing in so called "clientConnectionHandler" a selectionKey
> and a
> selectorHandler (that I can get from the context) and I use it for
> replying
> to the client. In the postExecute method I do a clean-up and remove
> the
> request and the "clientConnectionHandler".
>
> Now I"d like to be able to reply to a client like "the request is
> processing" to return true to the execute method and as soon as the
> server
> processed the request (it can take a lot of time) to have a
> mechanism for
> connecting server the client and to send the data to it.
>
> Now I"m facing the problem that if the server is ready to reply to the
> client, the postExecute method has been called already and the
> "clientConnectionHandler" has been removed already.
> How can I overcome this problem?
I think you need to store clientConnectionHandler (SelectionKey +
SelectorHandler) in some storage (map) outside request context, and
once you're ready to send a reply - use clientConnectionHandler to
send it.
Do you have some issues with that?

Thanks.

WBR,
Alexey.


>
> Thanx in advance,
> alaska
> --
> View this message in context: http://www.nabble.com/Connecting-server-to-a-client-in-an-asynchronous-way-tp24464520p24464520.html
> Sent from the Grizzly - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>