On 1/6/2016 6:48 PM, Alan Bateman wrote:
On 06/01/2016 06:40, Masayoshi Okutsu wrote:
On 1/5/2016 10:38 PM, Alan Bateman wrote:
One other question on this is whether there are concurrency issues
with the candidate list? I ask because candidateMap is a CHM but the
map value (the candidate list) seems to be queried (via the size
method) and updated in getCandidateLocale without any
synchronization. Is this a concern?
The candidate list (candidates) won't be modified once it's been put
in candidatesMap. Are you referring to some other case?
I should have been clearer. Suppose two threads invoke
LocaleDataStrategy's getCandidateLocales at round the same time. There
is no entry in the candidateMap so get will get the list of candidates
via the adpater or default control getCandidateLocales. If I read the
code correctly then they will both mutate this list and then race to
add it to the candidateMap. So maybe my question is really about the
return from adpater or default control getCandidateLocales - is it
okay to mutable this list, maybe these methods already return a new List?
Each call to adapter or default control getCandidateLocales creates a
new ArrayList. There should be no concurrent modification issues.
Masayoshi