Hi Steven,

On Sun, 16 Mar 2008 15:05:34 +0900, Steven <[EMAIL PROTECTED]> wrote:

Or Mina will remove them automatically?

Once a connection is closed, its associated session object will be garbage collected, and therefore all related attributes will be cleared by JVM.

And what should I do if I want to add lots of attributes to one IoSession?
Should I add them separately like this:
session.setAttachment(k1,v1);
session.setAttachment(k2,v2);
session.setAttachment(k3,v3);
Or should I create an class that contains all these attributes and then add this class to the IoSession's attribute map?

I recommend you to create a dedicated class that contains all attributes, because accessing attributes requires synchronization.

Is there any way to customize the IoSession class?
I mean , can I create my own IoSession class that contains all the attributes that I need and then call some methods like this to use it:
acceptor.SetIoSession(myOwnIoSession);

Please take a look at IoSessionAttributeInitializingFilter or IoSessionDataStructureFactory.

HTH,

--
Trustin Lee - Principal Software Engineer, JBoss, Red Hat
--
what we call human nature is actually human habit
--
http://gleamynode.net/

Reply via email to