You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Trustin Lee <tr...@gmail.com> on 2006/12/21 03:13:28 UTC

Re: Tiny optimization

On 12/1/06, Gaston Dombiak <ga...@jivesoftware.com> wrote:
>
> Hey guys,


Hi Gaston,

ExecutorThreadModel#getInstance(String) is blocking the entire Map. I
> would suggest reducing the area being blocked by synchronizing on the
> serviceName instead. So the change would be:
>
>
>
>         synchronized( service2model )
>
>
>
> would look like:
>
>
>
>         synchronized( serviceName.intern() )
>
>
>
> I'm still reading and learning MINA so don't know which other places
> could use the same optimization. Oh, if you are going to go with the
> syn'ing on Strings then the Map will have to be a ConcurrentHashMap.


We could use ConcurrentHashMap in 1.1, but we got rid of ThreadModel in 2.0,
so we won't have any problem you pointed out.

HTH,
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