On 9/4/11 1:45 PM, Antonio Rodriges wrote:
This greatly helps, Emmanuel, thank you,

There is one guarantee : once a session is associated with one IoProcessor
instance, it will be attached to the associatd thread. So if you don't add
an executor in your chain, then it's supposed to be thread-safe. However, if
you have cross-sessions elements, it's up to you to protect them against
concurrent access.
However, if I have SINGLE IoHandlerAdapter for both NioAcceptors,
  thus
my "number" variable is NOT thread safe?

You are responsible for the thread safety of your IoHandler instance. The only guarantee MINA carries is that it's thread safe, up to your application.

acceptor.setHandler(handler);
NioSocketAcceptor acceptor = new NioSocketAcceptor(2);
+code before

And if NioAcceptors run in several threads why do one needs an ExecutorFilter?

In some cases, you may want to have more than one thread executing some costly action, like decoding an expensive message, or accessing a database. This allows other users who are less demanding to be served whatever happens.


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

Reply via email to