Random shared by threads in RandomIndexWriter and MockAnalyzer
--------------------------------------------------------------
Key: LUCENE-3991
URL: https://issues.apache.org/jira/browse/LUCENE-3991
Project: Lucene - Java
Issue Type: Task
Reporter: Dawid Weiss
Priority: Minor
This is currently patched by creating a non-asserting Random like this:
{code}
public MockIndexWriter(Random r, Directory dir, IndexWriterConfig conf)
throws IOException {
super(dir, conf);
// TODO: this should be solved in a different way; Random should not be
shared (!).
this.r = new Random(r.nextLong());
}
{code}
and
{code}
public MockAnalyzer(Random random, CharacterRunAutomaton runAutomaton,
boolean lowerCase, CharacterRunAutomaton filter, boolean
enablePositionIncrements) {
super(new PerFieldReuseStrategy());
// TODO: this should be solved in a different way; Random should not be
shared (!).
this.random = new Random(random.nextLong());
{code}
If you replace new Random(...) with a simple assignment you'll get errors
indicating the Random instance is shared (or passed between threads). I don't
know how to fix it so I left it as it was before.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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]