Hi Steve,

I thought about this issue again and again every night (OK, I'm
exaggerating) and realized what you want to do (overriding
AbstractIoSession.write()) can be done alternatively by adding a
filter that intercepts the write call.  Does it fulfill your needs?

I also would like to emphasis again that making concrete methods final
in an abstract class is good for maintenance because it doesn't lead
the subclasses to weird behaviors at least.

Thanks,
Trustin

On Dec 3, 2007 5:18 PM, Steve Ulrich (proemion)
<[EMAIL PROTECTED]> wrote:
>
> Hi
>
>
> Trustin Lee wrote:
> >
> > On Nov 29, 2007 10:18 AM, Trustin Lee <[EMAIL PROTECTED]> 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
> tested.
>
> regards from Germany
> Steve
> --
> 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.
>
>



-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Reply via email to