mirror of https://github.com/apache/lucene.git
SOLR-7493: Initialize random correctly
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1683948 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e1ca83240e
commit
c49d7b654e
|
@ -117,10 +117,16 @@ import org.slf4j.LoggerFactory;
|
|||
public class HttpSolrCall {
|
||||
protected static Logger log = LoggerFactory.getLogger(HttpSolrCall.class);
|
||||
|
||||
protected static Random random;
|
||||
static final Random random;
|
||||
static {
|
||||
// We try to make things reproducible in the context of our tests by initializing the random instance
|
||||
// based on the current seed
|
||||
String seed = System.getProperty("tests.seed");
|
||||
random = new Random(seed != null ? Long.parseLong(seed) : System.currentTimeMillis());
|
||||
if (seed == null) {
|
||||
random = new Random();
|
||||
} else {
|
||||
random = new Random(seed.hashCode());
|
||||
}
|
||||
}
|
||||
|
||||
protected final SolrDispatchFilter solrDispatchFilter;
|
||||
|
|
Loading…
Reference in New Issue