What's the right way to terminate the server side of a connection?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

What's the right way to terminate the server side of a connection?

Glenn
Hi Grizzly Users,

I am working on (what amounts to) a variation of the echo server example where the server should terminate the connection after the client has received the echoed response. Calling ...

   ctx.getConnection().close();
   return ctx.getStopAction();

... from within my filter works, but I wonder if there's a better way.

Thanks,
--
Glenn
Reply | Threaded
Open this post in threaded view
|

Re: What's the right way to terminate the server side of a connection?

oleksiys
Administrator
Hi Glenn,

the code looks good... It might be better to call
ctx.getConnection().closeSilently();

if you don't really need Future object returned by close();

Thanks.

WBR,
Alexey.

On 27.01.14 21:06, Glenn wrote:

> Hi Grizzly Users,
>
> I am working on (what amounts to) a variation of the echo server
> example where the server should terminate the connection after the
> client has received the echoed response. Calling ...
>
>    ctx.getConnection().close();
>    return ctx.getStopAction();
>
> ... from within my filter works, but I wonder if there's a better way.
>
> Thanks,
> --
> Glenn