How to handle request / response
Jonathan Arnold
jdarnold at buddydog.org
Fri Jul 8 16:34:13 EDT 2011
On Fri, 8 Jul 2011 12:41:59 -0700
<Michael.Newcomb at gdc4s.com> wrote:
> This is an example of what I do for request/response. I edited it in
> e-mail, so excuse any typos.
Thanks for the ideas!
> Send request:
> Request<String> r = new MyRequest();
> channel.write(r);
> String s = r.getResponse();
The getResponse is the tricky part for me. How do you make it wait for
a response? Is that a function of the fact that the Requests interface
extends the ChannelFutureListener?
> public interface Request<R>
> extends ChannelFutureListener
> {
> long getId();
>
> void setId(long id);
>
> R getResponse()
> throws InterruptedException, Exception;
>
> void setResponse(Object response);
> }
--
Jonathan Arnold Webstream: http://hieronymus.soup.io
Talent wins games, but team work and intelligence wins championships.
Michael Jordan
More information about the netty-users
mailing list