peter royal wrote:
On Jul 5, 2008, at 1:36 PM, Emmanuel Lecharny wrote:
- as it's a framework, I think that exceptions, if they are to be
caught, should be caught at the upper level, not down in the code. Why
the hell do we have to define a generic monitor which does nothing
more than logging a warning ?

I don't really care to keep it into the code base, I just don't see
any of the advantages it brings. I may miss something ...

Can you give me a clear exemple, Peter ?

the monitor would allow a user to replace the functionality with one that throws rather than logs.. we just decided that logging is the best policy. we could just make it throw.

in the custom implementation i last used,

- if the exception is an InterruptedException, just ignore, but set the interrupted state on the current thread
 - certain exception types were ignored, no logging.
 - certain exceptions were logged at debug
 - catch-all was similar to what we ship
I see where you are going to. The problem to me is that the current implementation is really not good. First it's not documented correctly, or should I say, advertized, so the user have no clue what he will get if he implements the Monitor, second, it's a singleton, a very bad thing in a J2EE environment.

And as MINA is a framework, I also think that it should always throw an exception, and log something. Simply logging is not, IMO, enough. In certain cases, we don't know what will happen if we use the default implementation. For instance, you may swallow a OOM exception without doing nothing but logging. Do you think it's a good way to handle such exceptions ?

.. but the specifics of how i used it aside..
I agree.
i think the idea that it promotes is fine.
Well, I'm not on the same line :)
its not a piece of the codebase that's been causing issues at all :)
That, I agree. I just don't like the idea of ExceptionMonitor, at least the way it is used in MINA. It's pretty much a thread likely to be dead soon, as I don't want to argue forever about a very side element of the project. Just wanted to point out an opinion, but don't want to push it to a point we have to get a veto from someone :) As far as we get this piece of code self-explanatory in the Javadoc, it's fine...

Thanks Peter !

--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org


Reply via email to