Hi,

in MINA 2, session's attributes were stored using the AttributeKey class, which was concatenating a class name and a name :

private static final AttributeKey PROCESSOR = new AttributeKey( SimpleIoProcessorPool.class, "processor");
    ...
IoProcessor<S> processor = (IoProcessor<S>) session.getAttribute(PROCESSOR);
    ...
    session.setAttributeIfAbsent(PROCESSOR, processor);
    ...

Currently, the new IoSession is using five methods to manipulate Attributes :
<T> T getAttribute(String name);
<T> T setAttribute(String name, T value);
<T> T removeAttribute(String name);
    boolean containsAttribute(String name);
    Set<String> getAttributeNames();

All of them take a String as a key (the name), and a generic value.

I would suggest that we don't use the AttributeKey class at all, and instead, define each internal MINA Attribute by prefixing them with '__'. For instance, the SslContext would use the '__SslContext' key. The rational is that there is no reaon to use complex key, even if we have some collision risks.

wdyt ?



--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

Reply via email to