Le 29/07/2017 à 23:15, Christoph John a écrit :
> Hi,
>
> thanks, I'll test what you suggested.
> I've noticed that we have an exceptionCaught handler in one of our
> classes which extend the MINA IoHandlerAdapter. How is that different
> from the exceptionCaught handler in the filter?
No difference. The filter hadles events the same way the IoHandler does,
except that those events are handled by the filters *before* it reaches
the handler.

Actually, once a filter handles an event, it may passes it to the next
filter, and ultimately it bubbles up to the hoHandler. Here is the
Logging filter implementation :

    @Override
    public void exceptionCaught(NextFilter nextFilter, IoSession
session, Throwable cause) throws Exception {
        log(exceptionCaughtLevel, "EXCEPTION :", cause);
        nextFilter.exceptionCaught(session, cause);
    }


As you can see it calls the next filter exceptionCaught event. The last
filter in a chain is the TailFilter (you don't have to add it in your
chain, it's always there) and it calls your handler :


        @Override
        public void exceptionCaught(NextFilter nextFilter, IoSession
session, Throwable cause) throws Exception {
            AbstractIoSession s = (AbstractIoSession) session;

            try {
                s.getHandler().exceptionCaught(s, cause);
            } finally {
                if (s.getConfig().isUseReadOperation()) {
                    s.offerFailedReadFuture(cause);
                }
            }
        }




-- 

Emmanuel Lecharny

Symas.com
directory.apache.org

Reply via email to