Package org.apache.solr.core
Class TransientSolrCoreCacheDefault
- java.lang.Object
-
- org.apache.solr.core.TransientSolrCoreCache
-
- org.apache.solr.core.TransientSolrCoreCacheDefault
-
public class TransientSolrCoreCacheDefault extends TransientSolrCoreCache
Cache of the most frequently accessed transient cores. Keeps track of all the registered transient cores descriptors, including the cores in the cache as well as all the others.
-
-
Field Summary
Fields Modifier and Type Field Description protected CoreContainercoreContainerprotected com.github.benmanes.caffeine.cache.Cache<String,SolrCore>transientCores"Lazily loaded" cores cache with limited size.protected Map<String,CoreDescriptor>transientDescriptorsUnlimited map of all the descriptors for all the registered transient cores, including the cores in thetransientCoresas well as all the others.
-
Constructor Summary
Constructors Constructor Description TransientSolrCoreCacheDefault(CoreContainer coreContainer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SolrCoreaddCore(String name, SolrCore core)Adds the newly-opened core to the list of open cores.voidaddTransientDescriptor(String rawName, CoreDescriptor cd)Adds a newCoreDescriptor.booleancontainsCore(String name)Returns whether the cache contains the named core.Set<String>getAllCoreNames()Returns the names of all possible cores, whether they are currently loaded or not.CoreContainergetContainer()Gets the core container that encloses this cache.SolrCoregetCore(String name)Gets the core associated with the name.Set<String>getLoadedCoreNames()Returns the names of all currently loaded cores.intgetStatus(String coreName)Gets a custom status for the given core name.CoreDescriptorgetTransientDescriptor(String name)Gets theCoreDescriptorfor a transient core (loaded or unloaded).Collection<CoreDescriptor>getTransientDescriptors()Gets theCoreDescriptorfor all transient cores (loaded and unloaded).Collection<SolrCore>prepareForShutdown()This method will be called when the container is to be shut down.SolrCoreremoveCore(String name)Removes a core from the internal structures, presumably it being closed.CoreDescriptorremoveTransientDescriptor(String name)Removes aCoreDescriptorfrom the list of transient cores descriptors.voidsetStatus(String coreName, int status)Sets a custom status for the given core name.-
Methods inherited from class org.apache.solr.core.TransientSolrCoreCache
close
-
-
-
-
Field Detail
-
coreContainer
protected final CoreContainer coreContainer
-
transientCores
protected final com.github.benmanes.caffeine.cache.Cache<String,SolrCore> transientCores
"Lazily loaded" cores cache with limited size. When the max size is reached, the least accessed core is evicted to make room for a new core.
-
transientDescriptors
protected final Map<String,CoreDescriptor> transientDescriptors
Unlimited map of all the descriptors for all the registered transient cores, including the cores in thetransientCoresas well as all the others.
-
-
Constructor Detail
-
TransientSolrCoreCacheDefault
public TransientSolrCoreCacheDefault(CoreContainer coreContainer)
- Parameters:
coreContainer- The enclosingCoreContainer.
-
-
Method Detail
-
prepareForShutdown
public Collection<SolrCore> prepareForShutdown()
Description copied from class:TransientSolrCoreCacheThis method will be called when the container is to be shut down. It returns all transient solr cores and clear any internal structures that hold them.- Specified by:
prepareForShutdownin classTransientSolrCoreCache
-
getContainer
public CoreContainer getContainer()
Description copied from class:TransientSolrCoreCacheGets the core container that encloses this cache.- Specified by:
getContainerin classTransientSolrCoreCache
-
addCore
public SolrCore addCore(String name, SolrCore core)
Description copied from class:TransientSolrCoreCacheAdds the newly-opened core to the list of open cores.- Specified by:
addCorein classTransientSolrCoreCache
-
getAllCoreNames
public Set<String> getAllCoreNames()
Description copied from class:TransientSolrCoreCacheReturns the names of all possible cores, whether they are currently loaded or not.- Specified by:
getAllCoreNamesin classTransientSolrCoreCache
-
getLoadedCoreNames
public Set<String> getLoadedCoreNames()
Description copied from class:TransientSolrCoreCacheReturns the names of all currently loaded cores.- Specified by:
getLoadedCoreNamesin classTransientSolrCoreCache
-
removeCore
public SolrCore removeCore(String name)
Description copied from class:TransientSolrCoreCacheRemoves a core from the internal structures, presumably it being closed. If the core is re-opened, it will be re-added by CoreContainer.- Specified by:
removeCorein classTransientSolrCoreCache
-
getCore
public SolrCore getCore(String name)
Description copied from class:TransientSolrCoreCacheGets the core associated with the name. Returns null if there is none.- Specified by:
getCorein classTransientSolrCoreCache
-
containsCore
public boolean containsCore(String name)
Description copied from class:TransientSolrCoreCacheReturns whether the cache contains the named core.- Specified by:
containsCorein classTransientSolrCoreCache
-
addTransientDescriptor
public void addTransientDescriptor(String rawName, CoreDescriptor cd)
Description copied from class:TransientSolrCoreCacheAdds a newCoreDescriptor. This method will only be called during core discovery at startup.- Specified by:
addTransientDescriptorin classTransientSolrCoreCache
-
getTransientDescriptor
public CoreDescriptor getTransientDescriptor(String name)
Description copied from class:TransientSolrCoreCacheGets theCoreDescriptorfor a transient core (loaded or unloaded). This method is used when opening cores and the like. If you want to change a core's descriptor, override this method and return the current core descriptor.- Specified by:
getTransientDescriptorin classTransientSolrCoreCache
-
getTransientDescriptors
public Collection<CoreDescriptor> getTransientDescriptors()
Description copied from class:TransientSolrCoreCacheGets theCoreDescriptorfor all transient cores (loaded and unloaded).- Specified by:
getTransientDescriptorsin classTransientSolrCoreCache
-
removeTransientDescriptor
public CoreDescriptor removeTransientDescriptor(String name)
Description copied from class:TransientSolrCoreCacheRemoves aCoreDescriptorfrom the list of transient cores descriptors.- Specified by:
removeTransientDescriptorin classTransientSolrCoreCache
-
getStatus
public int getStatus(String coreName)
Description copied from class:TransientSolrCoreCacheGets a custom status for the given core name. Allows custom implementations to communicate arbitrary information as necessary.- Specified by:
getStatusin classTransientSolrCoreCache
-
setStatus
public void setStatus(String coreName, int status)
Description copied from class:TransientSolrCoreCacheSets a custom status for the given core name. Allows custom implementations to communicate arbitrary information as necessary.- Specified by:
setStatusin classTransientSolrCoreCache
-
-