Hi Trustin,

> Once any kind of event is fired, it is forwarded to IoHandler even if
the
> connection is being closed at the moment.  It is because all fired
events
> are stored in a queue.  But you shouldn't stop thread pools.
>
I am not sure that I stopped the thread pool or not?

**********When start my software, I did this stuff:
--BEGIN--
socketConfig = new SocketAcceptorConfig();                      
socketConfig.getFilterChain().addLast("codec",
        new ProtocolCodecFilter(new DataMessageProtocolCodecFactory()));
socketConfig.setReuseAddress(true);
                                        
protocolExecutor =
Executors.newFixedThreadPool(DCConf.MaxMinaThreadPool);
socketConfig.getFilterChain().addLast("threadpool", 
        new ExecutorFilter(protocolExecutor));
                                        
dcDataPortAcceptor = new SocketAcceptor();
port = (Integer) DCConf.DataPort.get(i);

dcDataPortAcceptor.bind(new InetSocketAddress(port),
        new DataMessageSessionHandler(port,
        this.dataProcessor), socketConfig);

                        
m_logger.debug("DC is listening on DataPort: " + port);
--END--

**********When stop my software, I just call:
--BEGIN--
dcDataPortAcceptor.unbindAll();
--END--

Do I miss any thing? Please advice me.

Thanks & best regards,
Hieu Phan.

> -----Original Message-----
> From: Trustin Lee [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, November 07, 2006 10:43 AM
> To: [email protected]
> Subject: Re: [MINA] Does MINA finish all "decoded messages" before
> stopping?
> 
> On 11/7/06, Hieu Phan Thanh <[EMAIL PROTECTED]> wrote:
> >
> > Hi Trustin,
> >
> > > Yes, it's correct.  Once the messageSent event is fired, it is
> > forwarded
> > > to
> > > IoHandler even if the connection is being closed at the moment.
It is
> > > because all events are stored in a queue.
> > >
> > I think the messageSent event is not related to what I meant. I
> > mentioned about the *decode* and *messageReceived* methods.
> 
> 
> Once any kind of event is fired, it is forwarded to IoHandler even if
the
> connection is being closed at the moment.  It is because all fired
events
> are stored in a queue.  But you shouldn't stop thread pools.
> 
> I want to withdraw my assumption because based on my test-results, it
> > was not correct.
> > I have added an counter (static variable) and this variable will be
> > increased 1 when the *decode()* is invoked and it will be decreased
1
> > when the *messageReceived()* is invoked. My expected result is when
the
> > system is stopped successful, this counter's value must be zero (0).
But
> > it was not.
> > Could we treat this problem is a bug of MINA framework?
> > Did you remember there was a time I asked about this kind of
questions?
> >
> > And I already had my own solution: the main thread will wait until
the
> > counter is zero before stopped successfully. But I think that mina
has
> > to finish all message by itself. How do you think?
> 
> 
> Could you make sure if your thread pool is not shut down yet?
> 
> Trustin
> --
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP key fingerprints:
> * E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
> * B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6

Reply via email to