Thanks in advance to anyone that has any input on this.  I might be doing 
something very simple wrong as I am a NOOB to Mina.  I am using the following 
mina version:


        org.apache.mina
        mina-core
        2.0.0-M1
        

I have been testing things with getting filters setup appropriately, and really 
like the way Mina is setup.  The problem I have discovered in my configuration 
is when I pull the network out from under my client connection (i.e. un-plug my 
network connection) I don't get any disconnection exceptions in the 
HandlerAdapter or a SessionClosed event (or anything for that matter).  Here 
are my major adapter methods-as you will see I implement the reconnection logic 
as stated in the FAQ; however, I am still seeing the issue.

@Override
    public void exceptionCaught(IoSession session, Throwable t) throws Exception
    {
        log.error("Session:" + session + " :: Exception:" + t);
    }

...
    @Override
    public void sessionClosed(IoSession session) throws Exception
    {
        // Wait for five seconds before reconnecting.
        Thread.sleep( 5000 );

        if(session.getService() instanceof IoConnector)
        {
            ((IoConnector)session.getService()).connect( 
session.getRemoteAddress() );
        }
    }

Here is my client connection code:

SocketAddress address = new InetSocketAddress("X.X.X.X",2000);
        
        NioSocketConnector ioConnector = new NioSocketConnector();

        //Add the price stream filter that will separate out the messages...
        
        ioConnector.getFilterChain().addLast( "binary-logger", new 
LoggingFilter() );
        ioConnector.getFilterChain().addLast( "protocolCodecFilter", 
(IoFilter)getBean("protocolCodecFilter") );
        ioConnector.getFilterChain().addLast( "authenticationFilter", 
(IoFilter)getBean("authenticationFilter") );

        ioConnector.setHandler( (IoHandler)getBean("ioHandler") );
        
        ConnectFuture cf = ioConnector.connect(address);
        cf.join();

ioHandler, the codec filter, and the authentication are all filters defined in 
my spring context.  The protocol filter is a custom implementation based off of 
the filters in source.  I am hoping this is a simple configuration thing I am 
going wrong, if not I will try to make a full example and replicate it.  Thanks 
so much for any help you may have!

-Eric

Reply via email to