Package org.apache.solr.ltr
Class LTRThreadModule
- java.lang.Object
- 
- org.apache.solr.core.CloseHook
- 
- org.apache.solr.ltr.LTRThreadModule
 
 
- 
- All Implemented Interfaces:
- NamedListInitializedPlugin
 
 public final class LTRThreadModule extends CloseHook implements NamedListInitializedPlugin The LTRThreadModule is optionally used by theLTRQParserPluginandLTRFeatureLoggerTransformerFactoryclasses to parallelize the creation ofFeature.FeatureWeightobjects.Example configuration: <queryParser name="ltr" class="org.apache.solr.ltr.search.LTRQParserPlugin"> <int name="threadModule.totalPoolThreads">10</int> <int name="threadModule.numThreadsPerRequest">5</int> </queryParser> <transformer name="features" class="org.apache.solr.ltr.response.transform.LTRFeatureLoggerTransformerFactory"> <int name="threadModule.totalPoolThreads">10</int> <int name="threadModule.numThreadsPerRequest">5</int> </transformer>If an individual solr instance is expected to receive no more than one query at a time, it is best to settotalPoolThreadsandnumThreadsPerRequestto the same value. If multiple queries need to be serviced simultaneously thentotalPoolThreadsandnumThreadsPerRequestcan be adjusted based on the expected response times. If the value ofnumThreadsPerRequestis higher, the response time for a single query will be improved up to a point. If multiple queries are serviced simultaneously, the value oftotalPoolThreadsimposes a contention between the queries if(totalPoolThreads < numThreadsPerRequest * total parallel queries).
- 
- 
Constructor SummaryConstructors Constructor Description LTRThreadModule()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacquireLTRSemaphore()SemaphorecreateQuerySemaphore()voidexecute(Runnable command)static LTRThreadModulegetInstance(NamedList args)voidinit(NamedList args)voidpostClose(SolrCore core)voidpreClose(SolrCore core)voidreleaseLTRSemaphore()voidsetExecutor(ExecutorService sharedExecutor)voidsetNumThreadsPerRequest(int numThreadsPerRequest)voidsetTotalPoolThreads(int totalPoolThreads)
 
- 
- 
- 
Method Detail- 
getInstancepublic static LTRThreadModule getInstance(NamedList args) 
 - 
initpublic void init(NamedList args) - Specified by:
- initin interface- NamedListInitializedPlugin
 
 - 
setTotalPoolThreadspublic void setTotalPoolThreads(int totalPoolThreads) 
 - 
setNumThreadsPerRequestpublic void setNumThreadsPerRequest(int numThreadsPerRequest) 
 - 
createQuerySemaphorepublic Semaphore createQuerySemaphore() 
 - 
acquireLTRSemaphorepublic void acquireLTRSemaphore() throws InterruptedException- Throws:
- InterruptedException
 
 - 
releaseLTRSemaphorepublic void releaseLTRSemaphore() throws InterruptedException- Throws:
- InterruptedException
 
 - 
executepublic void execute(Runnable command) 
 - 
setExecutorpublic void setExecutor(ExecutorService sharedExecutor) 
 
- 
 
-