You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Michael Bauroth <Mi...@falcom.de> on 2006/12/15 21:16:44 UTC

Sessionmanager vs. getManagedSessions()

Hi everyone,

I've only a short question regarding the pro and cons of separate 
storing all established sessions in a separate Hashmap. The background 
for this is, that each device (client) has a unique id, which is also 
available on the serverside. From this side it would make sense to store 
the sessions with it's keys in a hashmap, so that questions from any 
webclient for a explicit device could very quickly retrieved over this 
mapping.

On the other side I think I remember, that in older discussion threads 
somybody said, that such programming behaviour wouldn't be good and it 
would be better to search a given session over getManagedSessions() and 
a attribute on the session itself.

So what do you think? What would you recommend?

Any help would be very appreciated.

Thanx in advance
Michael

Re: Sessionmanager vs. getManagedSessions()

Posted by Trustin Lee <tr...@gmail.com>.
On 12/16/06, Michael Bauroth <Mi...@falcom.de> wrote:
>
> Hi everyone,
>
> I've only a short question regarding the pro and cons of separate
> storing all established sessions in a separate Hashmap. The background
> for this is, that each device (client) has a unique id, which is also
> available on the serverside. From this side it would make sense to store
> the sessions with it's keys in a hashmap, so that questions from any
> webclient for a explicit device could very quickly retrieved over this
> mapping.
>
> On the other side I think I remember, that in older discussion threads
> somybody said, that such programming behaviour wouldn't be good and it
> would be better to search a given session over getManagedSessions() and
> a attribute on the session itself.
>
> So what do you think? What would you recommend?


Either way will be fine I guess, but I prefer session attribute to a
separate map.  You might also want to look at multiton package (
org.apache.mina.handler.multiton) to store custom fields more easily.

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6