SOLR-14206: Annotate HttpSolrCall as thread-safe (#1203)

* SOLR-14206: Annotate HttpSolrCall and V2HttpCall as thread-safe
This commit is contained in:
Anshum Gupta 2020-01-23 08:37:03 -08:00 committed by GitHub
parent 60a2926546
commit 3c0146196a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -38,6 +38,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.annotation.SolrThreadSafe;
import org.apache.solr.common.cloud.DocCollection;
import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.CommonParams;
@ -62,6 +63,7 @@ import org.slf4j.LoggerFactory;
import com.google.common.collect.ImmutableSet;
// class that handle the '/v2' path
@SolrThreadSafe
public class V2HttpCall extends HttpSolrCall {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private Api api;

View File

@ -60,6 +60,7 @@ import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.impl.HttpClientUtil;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.solr.common.annotation.SolrThreadSafe;
import org.apache.solr.common.cloud.Aliases;
import org.apache.solr.common.cloud.ClusterState;
import org.apache.solr.common.cloud.DocCollection;
@ -134,6 +135,7 @@ import static org.apache.solr.servlet.SolrDispatchFilter.Action.RETURN;
/**
* This class represents a call made to Solr
**/
@SolrThreadSafe
public class HttpSolrCall {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@ -414,14 +416,12 @@ public class HttpSolrCall {
if (path.equals(req.getServletPath())) {
// avoid endless loop - pass through to Restlet via webapp
action = PASSTHROUGH;
SolrRequestInfo.getRequestInfo().setAction(action);
return;
} else {
// forward rewritten URI (without path prefix and core/collection name) to Restlet
action = FORWARD;
SolrRequestInfo.getRequestInfo().setAction(action);
return;
}
SolrRequestInfo.getRequestInfo().setAction(action);
return;
}
}
@ -1123,7 +1123,7 @@ public class HttpSolrCall {
}
@Override
public Enumeration getHeaderNames() {
public Enumeration<String> getHeaderNames() {
return getReq().getHeaderNames();
}