users@grizzly.java.net

Re: Track active clients using Connection or FilterChainContext

From: Oleksiy Stashok <oleksiy.stashok_at_oracle.com>
Date: Thu, 12 Jun 2014 18:15:57 -0700

Hey,

On 12.06.14 17:59, LongkerDandy wrote:
> I have a TCP serevr and I want to track all active clients connection,
> so clients can send message to each other.
> For now I'm using Grizzly's util DataStructures to maintain client'id
> and FilterChainContext in a map.
> I wondered:
>
> 1. Should using Connection instead of FilterChainContext. It seems
> more lightweight and Grizzly's auth sample is using Connection.
It's possible, the only downside is that you can't use
Connection.write() for Connections, that use port unification.

> 2. If a send message via Connection.write(...), will it still trigger
> filtter chain correctly?
Yes, but as I mentioned it won't work with port unification.

We have that fixed on Grizzly master, where instead of tracking unified
protocol through BackChannelFilter - we just create a new FilterChain
with recognized protocol in it and assign this FilterChain to the
Connection. Probably we have to find time and backport that change to
Grizzly 2.3.x.

Thanks.

WBR,
Alexey.