You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by fratre <fr...@gmail.com> on 2005/10/22 04:55:10 UTC

[mina]A small question about BlacklistFilter

I'm browsing the code of mina-0.9.

In the BlacklistFilter.java, I found it used like super.messageReceived(...)
to forward event, such as:
    /**
     * Forwards event if and if only the remote address of session is not
     * blacklisted.
     */
    public void messageReceived( NextFilter nextFilter, IoSession session,
                                 Object message ) throws Exception
    {
        if( !isBlocked( session ) )
        {
            // forward if not blocked
            super.messageReceived( nextFilter, session, message );
        }
    }

My question is: why not directly use such as nextFilter.messageReceived(
...) or nextFilter.sessionOpened(...)?

thx

-- 
fratre <fr...@gmail.com>


Re: [mina]A small question about BlacklistFilter

Posted by fratre <fr...@gmail.com>.
yes, I review the IoFilterAdapter.java before ask my question:)

I think the filter should has a common behavior, so I has't thought very  clear
why the behavior is not same as  the other filters. you see, all the
other filters use codes like nextFilter.xxx but not super.xxx. That's
why I think maybe there are some other meaning. 

now, I know that them are the same.

thx

-- 
fratre <fr...@gmail.com>


Re: [mina]A small question about BlacklistFilter

Posted by Trustin Lee <tr...@gmail.com>.
Hi,

2005/10/22, fratre <fr...@gmail.com>:
>
> I'm browsing the code of mina-0.9.
>
> In the BlacklistFilter.java, I found it used like super.messageReceived
> (...)
> to forward event, such as:
> /**
> * Forwards event if and if only the remote address of session is not
> * blacklisted.
> */
> public void messageReceived( NextFilter nextFilter, IoSession session,
> Object message ) throws Exception
> {
> if( !isBlocked( session ) )
> {
> // forward if not blocked
> super.messageReceived( nextFilter, session, message );
> }
> }
>
> My question is: why not directly use such as nextFilter.messageReceived(
> ...) or nextFilter.sessionOpened(...)?


It is because it is same essentially. Please take a look at
IoFilterAdapter.java. :)

Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/