mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Ulrich (proemion)" <steve.ulr...@proemion.com>
Subject Re: final AbstractIoSession
Date Mon, 03 Dec 2007 08:18:58 GMT


Trustin Lee wrote:
> On Nov 29, 2007 10:18 AM, Trustin Lee <trustin@gmail.com> wrote:
>> The reason I changed all the methods in AbstractIoSession to be final
>> was because I didn't see much room for extension there.  If there's
>> any need for extension, I thought it's better idea to provide
>> additional protected abstract methods while retaining them as final.

providing additional methods would be ok. Just having a (abstract) class
without any possibility to extend it will lead to problems at some
time/point, I think. Even if the normal way to change/encode/log messages is
a filter at the chain, there may be some special requirement to extend the
write method or any other method. I'm very careful with final statements,
because you don't know what other people will do with your classes (and
sometimes you don't want to know ;-) )

>> All I/O requests to AbstractIoSession will be forwarded to an
>> IoProcessor.  You can set the processor of the DummySession by calling
>> setProcessor() and you can override flush() there

That's an idea. actually I don't know how to implement this, but maybe I get
it working.

>> However, it's very inconvenient to implement a dummy IoProcessor
>> comparing to just overriding write() method.  Let me rewrite
>> DummySession not extending AbstractIoSession for maximum flexibility.

That would be nice :-)

> Alternatively, you could simply set your IoHandler to get notified
> when write() method is invoked?  Doesn't it make sense?

I don't think so. My IoHandler is the tested class, and the test method
wants to know if the IoHandler writes out the correct messages and does
other things correctly. So the IoHandler shouldn't know that it's beeing

regards from Germany
View this message in context: http://www.nabble.com/final-AbstractIoSession-tf4889613s16868.html#a14125321
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.

View raw message