[
https://issues.apache.org/jira/browse/DIRMINA-410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12516172
]
im-james commented on DIRMINA-410:
----------------------------------
I'm looking at that again and I think that I have missed a few method in the
branch 1.1.1.
As you synchronized (indirectly) the puts (IE: when you set "this.entries =
newEntries;") you have to synchronize the get too.
This means that the following methods:
public void buildFilterChain(IoFilterChain chain) throws Exception{...}
public String toString() {...}
public Object clone() {...}
should also be synchronized:
public synchronized void buildFilterChain(IoFilterChain chain) throws
Exception{...}
public synchronized String toString() {...}
public synchronized Object clone() {...}
The reason for that is that you iterate over "entries" and if you don't
synchronize I think that some visibility problem might occur.
> DefaultIoFilterChainBuilder synchronization issue with contains(...) methods
> ----------------------------------------------------------------------------
>
> Key: DIRMINA-410
> URL: https://issues.apache.org/jira/browse/DIRMINA-410
> Project: MINA
> Issue Type: Bug
> Affects Versions: 1.1.1, 2.0.0-M1
> Reporter: im-james
> Fix For: 1.1.2, 2.0.0-M1
>
>
> In org.apache.mina.common.DefaultIoFilterChainBuilder, most public methods
> are synchronized to guard the variables "entries" and "entriesByName".
> However, 2 methods are not synchronized and I believe that they should be
> synchronized.
> I'm talking about these 2:
> public boolean contains(IoFilter filter) {...}
> public boolean contains(Class<? extends IoFilter> filterType) {...}
> it should be:
> public synchronized boolean contains(IoFilter filter) {...}
> public synchronized boolean contains(Class<? extends IoFilter> filterType)
> {...}
> The version on the trunk is different but I've got the impression that there
> is another type of bug:
> I've noticed that the variable "entries" is initialized with a "new
> CopyOnWriteArrayList<Entry>()". However, the clear() method put a regular
> "new ArrayList<Entry>()" into it. This is probably not what is intended.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.