Le 18/08/2017 à 07:53, 胡阳 a écrit : > Hi guys:
Hi ! (Sorry, I can't use your first name, my keyboard is a bit limited ;-) > I read the source code of MINA3.0M2. The style of the code is very good, the > structure is clear, the design is concise and efficient, especially the use > of Selector is unexpected. However, the enqueueWriteRequest method and the > processWrite method in the AbstractNioSession are somewhat flawed. Probably :-) This is just an effort to improve from MINA 2, and we are very open to any proposal ! > I see the source code in the enqueueWriteRequest method was originally > "synchronized (writeQueue)", but was commented out, personal speculation may > be the author feel that this treatment will affect performance. You are looking at an old version of the code base. The current (not released) version is using a ConcurrentLinkedQueue, which does not require a synchronized anymore. > My approach is to use CAS to ensure memory visibility and atomic, see I see > the startSync, finishSync method, feeling that this may be more secure after > some of the performance will not lose too much. > A little personal humble opinion. And we don't disagree :-) If you are interested in this code, feel free to dig the trunk, which contains the latest changes. Note that it's not a very active project atm, but we would really appreciate any contribution ! You can also use github to push PR, would you feel like contributing : https://github.com/apache/mina Thanks ! -- Emmanuel Lecharny Symas.com directory.apache.org