[
https://issues.apache.org/jira/browse/LUCENE-2943?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13000514#comment-13000514
]
Robert Muir commented on LUCENE-2943:
-------------------------------------
Uwe, that is one alternative.
The only reason i did it this way, is because I felt it was a bit of a trap (to
any users using the Filter directly). This is because JDK collators are in fact
thread safe.
{quote}
This is a slight difference, because the following code is always safe:
new CollationFilter(Collator.newInstance(lang)), cloning would be wrong.
{quote}
I don't think this is really a reasonable example, usually in the search engine
you would never use code like this: the sort keys will be way too large for no
reason. For example usually its the case you will set something more reasonable
like primary strength (case-insensitive).
Because the clone is cheap, and this is a trap to users, I'm still going to
fight for my original patch. This way the ICU and JDK functionality behave
consistently from a user perspective.
> ICU collator thread-safety issues
> ---------------------------------
>
> Key: LUCENE-2943
> URL: https://issues.apache.org/jira/browse/LUCENE-2943
> Project: Lucene - Java
> Issue Type: Bug
> Components: Analysis
> Reporter: Robert Muir
> Fix For: 3.1, 4.0
>
> Attachments: LUCENE-2943.patch
>
>
> The ICU Collators (unlike the JDK ones) aren't thread safe:
> http://userguide.icu-project.org/collation/architecture , a little
> non-obvious since its not mentioned
> in the javadocs, and its not clear if the docs apply to only the C code, but
> i looked
> at the source and there is all kinds of internal state.
> So in my opinion, we should clone the icu collators (which are passed in from
> the outside)
> when creating a new TokenStream/AttributeImpl to prevent problems. This
> shouldn't be a big
> deal since everything uses reusableTokenStream anyway.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]