Class ShardHandler
java.lang.Object
org.apache.solr.handler.component.ShardHandler
- Direct Known Subclasses:
HttpShardHandler
Executes, tracks, and awaits all shard-requests made in the course of a distributed request.
New ShardHandler instances are created for each individual distributed request, and should not be assumed to be thread-safe.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidCancels all uncompleted requests managed by this instanceabstract ShardHandlerFactoryabstract voidBootstraps any data structures needed by the ShardHandler to execute or track outgoing requests.static voidsetShardAttributesToParams(org.apache.solr.common.params.ModifiableSolrParams params, int purpose) abstract voidsubmit(ShardRequest sreq, String shard, org.apache.solr.common.params.ModifiableSolrParams params) Sends a request (represented bysreq) to the specified shard.abstract ShardResponseReturns a ShardResponse of the last response correlated with a ShardRequest.abstract ShardResponseReturns a ShardResponse of the last response correlated with a ShardRequest, or immediately returns a ShardResponse if there was an error detected.
-
Constructor Details
-
ShardHandler
public ShardHandler()
-
-
Method Details
-
prepDistributed
Bootstraps any data structures needed by the ShardHandler to execute or track outgoing requests.- Parameters:
rb- provides access to request and response state.
-
submit
public abstract void submit(ShardRequest sreq, String shard, org.apache.solr.common.params.ModifiableSolrParams params) Sends a request (represented bysreq) to the specified shard.The outgoing request may be sent asynchronously. Callers must invoke
takeCompletedIncludingErrors()ortakeCompletedOrError()to inspect the success or failure of requests.- Parameters:
sreq- metadata about the series of sub-requests that the outgoing request belongs to and should be tracked with.shard- URLs for replicas of the receiving shard, delimited by '|' (e.g. "http://solr1:8983/solr/foo1|http://solr2:7574/solr/foo2")params- query-parameters set on the outgoing request
-
takeCompletedIncludingErrors
Returns a ShardResponse of the last response correlated with a ShardRequest. This won't return early if it runs into an error. Callers are responsible for ensuring that this can't be called before requests have been submitted with submit. -
takeCompletedOrError
Returns a ShardResponse of the last response correlated with a ShardRequest, or immediately returns a ShardResponse if there was an error detected. Callers are responsible for ensuring that this can't be called before requests have been submitted with submit. -
cancelAll
public abstract void cancelAll()Cancels all uncompleted requests managed by this instance -
getShardHandlerFactory
-
setShardAttributesToParams
public static void setShardAttributesToParams(org.apache.solr.common.params.ModifiableSolrParams params, int purpose)
-