Hi,

since there are a few weeks gone since my question, I don't remember the complete idea behind at the moment. :) For the rest I wrote a workaround, but may be a modified DemuxingIoHandler would be the better option to avoid additional exception throws. Don't know ... WDYT?

I have implemented a nested 2-stage protocol with many different codecs, messages and message handlers. In some cases it can be, that incoming messages aren't identified as a special message but instead only as a simple key-value-pair or anything else. For such "unknown" messages I haven't registered a separate handler in my TcpSessionHandler, but want to try handle it also ...

My current solution looks like this:

public void messageReceived( IoSession pSession, Object pMsg )
throws Exception
{
  try
  {
    super.messageReceived( pSession, pMsg );
  }
  catch ( UnknownMessageTypeException e )
  {
    if ( mDefaultHandler != null )
    {
      mDefaultHandler.messageReceived( pSession, pMsg );
    }
    else
    {
      mLogger.error( "Unknown message type received: ", e );
    }
  }
}

Best Regards
Michael



Trustin Lee wrote:

Could you tell me 'the special behavior' you are going to implement?

Thanks in advance,
Trustin

On 8/14/06, Michael Bauroth <[EMAIL PROTECTED]> wrote:


Hi,

I want to implement some special behaviour in an own IoHandler derived
from DemuxingIoHandler. Unfortunately the findHandler methods are
implemented as private methods, so that I must implement the whole stuff
again :(
Would it be possible, that Mina gives us the opportunity to simple
override the messageReceived method while using the original findHandler
methods as protected? In an object oriented context it should make more
sense than implementing a copy of this methods in the derived classes
again.
WDYT?

Best Regards
Michael





Reply via email to