2006/1/23, Trustin Lee <[EMAIL PROTECTED]>:
> * No more transport-type specific property getters and setters.
> Now we use IoAddress properties and the user-defined attributes in
> IoSession.  For example:

I liked the transport-specific getters and setters, since it provided
a level of type-safety when setting the properties, and you knew what
you were setting (there was javadoc on the methods, no chance of mis-
typing the attribute name, etc).

Right.  Now they are gone.  This approach has a trade-off you mentioned.  The advantage of user-defined attributes is that you don't need to downcast and that it provides more flexibility.  For example, let's assume that you need to switch to new AIO transport type implementation.  All you need to do is change the providerType to 'aio' from 'nio' in IoAddress.  With the old API, you'll have to add more 'if ( session instanceof ... ) { ... setReceiveBufferSize(...); }' sentences as you change the provider.  But with string key, it works only if the providers used the same keys.

Of course, this problem could be resolved if the authors of AIO provider and NIO provider agreed on creating a common interface, but I think it's too ideal.

I forgot to mention that we could provide a standardized set of attributes as a documentation.

Thanks,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
PGP Key ID: 0x854B996C

Reply via email to