Class DefaultSolrClientPool
- java.lang.Object
-
- de.hybris.platform.solrfacetsearch.solr.impl.DefaultSolrClientPool
-
- All Implemented Interfaces:
SolrClientPool,org.springframework.beans.factory.InitializingBean
public class DefaultSolrClientPool extends java.lang.Object implements SolrClientPool, org.springframework.beans.factory.InitializingBean
Default implementation forSolrClientPool.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classDefaultSolrClientPool.SolrClientPoolTenantListener
-
Field Summary
Fields Modifier and Type Field Description protected static longCHECK_INTERVAL_DEFAULT_VALUEprotected static java.lang.StringCHECK_INTERVAL_PROPERTYprotected static java.lang.StringCHECK_THREAD_NAME_PREFIXprotected static java.lang.StringCREATE_METHOD_PARAMprotected static java.lang.StringINDEX_PARAMprotected static longSCHEDULER_TERMINATION_TIMEOUTprotected static java.lang.StringSOLR_CLIENT_PARAM
-
Constructor Summary
Constructors Constructor Description DefaultSolrClientPool()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()protected SolrClientsWrappercheck(java.lang.String solrServerConfigName, SolrClientsWrapper clientsWrapper)protected voidcheckAll()protected CachedSolrClientcreateSolrClient(SolrConfig solrConfig, SolrClientConfig solrClientConfig, java.util.function.Function<SolrConfig,org.apache.solr.client.solrj.SolrClient> createMethod, java.util.function.Consumer<org.apache.solr.client.solrj.SolrClient> closeMethod)protected TenantListenercreateTenantListener()protected voiddestroySession()protected SolrClientsWrapperdoGetOrCreate(SolrConfig solrConfig, SolrClientsWrapper clientsWrapper, SolrClientType clientType, java.util.function.Function<SolrConfig,org.apache.solr.client.solrj.SolrClient> createMethod, java.util.function.Consumer<org.apache.solr.client.solrj.SolrClient> closeMethod)ConfigurationServicegetConfigurationService()ModelServicegetModelService()CachedSolrClientgetOrCreate(Index index, SolrClientType clientType, java.util.function.Function<SolrConfig,org.apache.solr.client.solrj.SolrClient> createMethod)Returns aSolrClientfrom the pool or creates it if it does not exist.CachedSolrClientgetOrCreate(Index index, SolrClientType clientType, java.util.function.Function<SolrConfig,org.apache.solr.client.solrj.SolrClient> createMethod, java.util.function.Consumer<org.apache.solr.client.solrj.SolrClient> closeMethod)Returns aSolrClientfrom the pool or creates it if it does not exist.protected java.util.concurrent.ScheduledExecutorServicegetScheduler()SessionServicegetSessionService()protected java.util.concurrent.ConcurrentMap<java.lang.String,SolrClientsWrapper>getSolrClients()Converter<SolrServerConfigModel,SolrConfig>getSolrServerConfigConverter()SolrServerConfigDaogetSolrServerConfigDao()protected java.lang.StringgetTenantId()TenantServicegetTenantService()protected voidinitializeSession()voidinvalidateAll()Invalidates the clients pool.protected SolrServerConfigModelloadSolrServerConfig(java.lang.String name)protected CachedSolrClientresolveSolrClient(SolrClientsWrapper clientsWrapper, SolrClientType solrClientType)voidsetConfigurationService(ConfigurationService configurationService)voidsetModelService(ModelService modelService)voidsetSessionService(SessionService sessionService)voidsetSolrServerConfigConverter(Converter<SolrServerConfigModel,SolrConfig> solrServerConfigConverter)voidsetSolrServerConfigDao(SolrServerConfigDao solrServerConfigDao)voidsetTenantService(TenantService tenantService)protected voidstartCleanUpThread()protected voidstopCleanUpThread()
-
-
-
Field Detail
-
INDEX_PARAM
protected static final java.lang.String INDEX_PARAM
- See Also:
- Constant Field Values
-
SOLR_CLIENT_PARAM
protected static final java.lang.String SOLR_CLIENT_PARAM
- See Also:
- Constant Field Values
-
CREATE_METHOD_PARAM
protected static final java.lang.String CREATE_METHOD_PARAM
- See Also:
- Constant Field Values
-
CHECK_INTERVAL_PROPERTY
protected static final java.lang.String CHECK_INTERVAL_PROPERTY
- See Also:
- Constant Field Values
-
CHECK_INTERVAL_DEFAULT_VALUE
protected static final long CHECK_INTERVAL_DEFAULT_VALUE
- See Also:
- Constant Field Values
-
CHECK_THREAD_NAME_PREFIX
protected static final java.lang.String CHECK_THREAD_NAME_PREFIX
- See Also:
- Constant Field Values
-
SCHEDULER_TERMINATION_TIMEOUT
protected static final long SCHEDULER_TERMINATION_TIMEOUT
- See Also:
- Constant Field Values
-
-
Method Detail
-
getTenantId
protected java.lang.String getTenantId()
-
getScheduler
protected java.util.concurrent.ScheduledExecutorService getScheduler()
-
getSolrClients
protected java.util.concurrent.ConcurrentMap<java.lang.String,SolrClientsWrapper> getSolrClients()
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
getOrCreate
public CachedSolrClient getOrCreate(Index index, SolrClientType clientType, java.util.function.Function<SolrConfig,org.apache.solr.client.solrj.SolrClient> createMethod) throws SolrServiceException
Description copied from interface:SolrClientPoolReturns aSolrClientfrom the pool or creates it if it does not exist.- Specified by:
getOrCreatein interfaceSolrClientPool- Parameters:
index- -IndexclientType- -SolrClientTypecreateMethod- - method used to create a new instance ofSolrClient- Returns:
SolrClient- Throws:
SolrServiceException- if an error occurs
-
getOrCreate
public CachedSolrClient getOrCreate(Index index, SolrClientType clientType, java.util.function.Function<SolrConfig,org.apache.solr.client.solrj.SolrClient> createMethod, java.util.function.Consumer<org.apache.solr.client.solrj.SolrClient> closeMethod) throws SolrServiceException
Description copied from interface:SolrClientPoolReturns aSolrClientfrom the pool or creates it if it does not exist.- Specified by:
getOrCreatein interfaceSolrClientPool- Parameters:
index- -IndexclientType- -SolrClientTypecreateMethod- - method used to create a new instance ofSolrClientcloseMethod- - method used to release resources associated with the created instance ofSolrClient- Returns:
SolrClient- Throws:
SolrServiceException- if an error occurs
-
invalidateAll
public void invalidateAll()
Description copied from interface:SolrClientPoolInvalidates the clients pool.- Specified by:
invalidateAllin interfaceSolrClientPool
-
resolveSolrClient
protected CachedSolrClient resolveSolrClient(SolrClientsWrapper clientsWrapper, SolrClientType solrClientType)
-
doGetOrCreate
protected SolrClientsWrapper doGetOrCreate(SolrConfig solrConfig, SolrClientsWrapper clientsWrapper, SolrClientType clientType, java.util.function.Function<SolrConfig,org.apache.solr.client.solrj.SolrClient> createMethod, java.util.function.Consumer<org.apache.solr.client.solrj.SolrClient> closeMethod)
-
createSolrClient
protected CachedSolrClient createSolrClient(SolrConfig solrConfig, SolrClientConfig solrClientConfig, java.util.function.Function<SolrConfig,org.apache.solr.client.solrj.SolrClient> createMethod, java.util.function.Consumer<org.apache.solr.client.solrj.SolrClient> closeMethod)
-
createTenantListener
protected TenantListener createTenantListener()
-
loadSolrServerConfig
protected SolrServerConfigModel loadSolrServerConfig(java.lang.String name)
-
startCleanUpThread
protected void startCleanUpThread()
-
stopCleanUpThread
protected void stopCleanUpThread()
-
initializeSession
protected void initializeSession()
-
checkAll
protected void checkAll()
-
check
protected SolrClientsWrapper check(java.lang.String solrServerConfigName, SolrClientsWrapper clientsWrapper)
-
destroySession
protected void destroySession()
-
getModelService
public ModelService getModelService()
-
setModelService
public void setModelService(ModelService modelService)
-
getConfigurationService
public ConfigurationService getConfigurationService()
-
setConfigurationService
public void setConfigurationService(ConfigurationService configurationService)
-
getTenantService
public TenantService getTenantService()
-
setTenantService
public void setTenantService(TenantService tenantService)
-
getSessionService
public SessionService getSessionService()
-
setSessionService
public void setSessionService(SessionService sessionService)
-
getSolrServerConfigDao
public SolrServerConfigDao getSolrServerConfigDao()
-
setSolrServerConfigDao
public void setSolrServerConfigDao(SolrServerConfigDao solrServerConfigDao)
-
getSolrServerConfigConverter
public Converter<SolrServerConfigModel,SolrConfig> getSolrServerConfigConverter()
-
setSolrServerConfigConverter
public void setSolrServerConfigConverter(Converter<SolrServerConfigModel,SolrConfig> solrServerConfigConverter)
-
-