[
https://issues.apache.org/jira/browse/OPENNLP-1320?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17250342#comment-17250342
]
ASF GitHub Bot commented on OPENNLP-1320:
-----------------------------------------
jzonthemtn commented on a change in pull request #385:
URL: https://github.com/apache/opennlp/pull/385#discussion_r544336034
##########
File path:
opennlp-morfologik-addon/src/main/java/opennlp/morfologik/lemmatizer/MorfologikLemmatizer.java
##########
@@ -47,7 +47,7 @@ public MorfologikLemmatizer(Dictionary dictionary) throws
IllegalArgumentExcepti
dictLookup = new DictionaryLookup(dictionary);
}
- private List<String> lemmatize(String word, String postag) {
+ private synchronized List<String> lemmatize(String word, String postag) {
Review comment:
I tend to think predictability is more important than impact to
performance. A wrong answer isn't helpful no matter how fast it gets returned.
So I would favor the `synchronized` as long as we're sure it's the best
implementation choice.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Makes lemmatize of MorfologikLemmatizer thread-safe
> ---------------------------------------------------
>
> Key: OPENNLP-1320
> URL: https://issues.apache.org/jira/browse/OPENNLP-1320
> Project: OpenNLP
> Issue Type: Bug
> Reporter: Lucas Avanço
> Priority: Major
>
> The method lemmatize of MorfologikLemmatizer is not thread-safe.
> Concurrent invokes may rise exceptions and return unpredictable resutls.
> It seems that the whole method must be sync because the variable returned by
> the morfologik lib is shared between threads.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)