I'm very thanks for your quick response.

Upgrading MINA version is next choice and I should find out problem in current 
using version and situation ^^

I'm wondering thread safety of all method because it isn't commented explicitly.
Especially, I have a question about thread safety of 
NioSocketConnector.connect() method.
I'v defined a global NioSocketConnector object and using in different thread 
because of reconnecting.
Should I synchronized the connector?

Thank you

-----Original Message-----
From: Emmanuel Lécharny [mailto:[email protected]] 
Sent: Monday, December 01, 2014 2:53 PM
To: [email protected]
Subject: Re: Are all MINA APIs thread unsafe except IoSession?

Le 01/12/14 06:20, 주재경 a écrit :
> Hi,
>
> Sorry for incorrect version information.
> Exact version is 2.0.0-RC1.
>
>       mina-core-2.0.0-RC1.jar
>       mina-integration-beans-2.0.0-RC1.jar
>       mina-integration-jmx-2.0.0-RC1.jar
>       mina-integration-ognl-2.0.0-RC1.jar

You should urgently switch to 2.0.9. 2.0.0-RC1 is four years old, since then, 
we have released 9 versions which are all bug fixes releases...
>
> My problem is about connecting or reading/writing problem and I'm doubting 
> thread problem.

Again, if you don't explain what kind of problem you are facing, it's hard to 
help...
> I don't synchronized to MINA object and it seems mistake.

Depends...
> So I checked API document and found no mention about thread safety.
Consider that : if you have sopme code in the codec or in your handler that is 
not thread safe, then you are going to have a problem. MINA is using threads to 
process sessions, so you may - and will - have many threads potentially sharing 
some informations. You have to make sure they are protected.

You can store data into the session's attributes, so you are sure that two 
different sessions processed by two different threads won't compete for those 
informations.

Now, there is one tricky part : you may have two threads processing one single 
session *of* you have added an Executor filter in your chain. In this case, you 
have to take care of the shared information for those specific sessions.

Beside that, you should be safe.



Reply via email to