You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2015/06/06 22:11:20 UTC
svn commit: r1683948 -
/lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
Author: shalin
Date: Sat Jun 6 20:11:20 2015
New Revision: 1683948
URL: http://svn.apache.org/r1683948
Log:
SOLR-7493: Initialize random correctly
Modified:
lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java?rev=1683948&r1=1683947&r2=1683948&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java Sat Jun 6 20:11:20 2015
@@ -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;