Package org.apache.solr.pkg
Class PackageListeningClassLoader
- java.lang.Object
-
- org.apache.solr.pkg.PackageListeningClassLoader
-
- All Implemented Interfaces:
org.apache.solr.common.cloud.SolrClassLoader
,PackageListeners.Listener
public class PackageListeningClassLoader extends Object implements org.apache.solr.common.cloud.SolrClassLoader, PackageListeners.Listener
ASolrClassLoader
that is designed to listen to a set of packages. This class registers a listener for each package that is loaded through this. If any of those packages are updated, the onReload runnable is run
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.solr.pkg.PackageListeners.Listener
PackageListeners.Listener.Ctx
-
-
Constructor Summary
Constructors Constructor Description PackageListeningClassLoader(CoreContainer coreContainer, org.apache.solr.common.cloud.SolrClassLoader fallbackClassLoader, Function<String,String> pkgVersionSupplier, Runnable onReload)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
changed(SolrPackageLoader.SolrPackage pkg, PackageListeners.Listener.Ctx ctx)
A callback when the package is updatedprotected void
doReloadAction(PackageListeners.Listener.Ctx ctx)
<T> Class<? extends T>
findClass(String cname, Class<T> expectedType)
SolrPackageLoader.SolrPackage.Version
findPackageVersion(PluginInfo.ClassName cName, boolean registerListener)
This looks up for package and also listens for that package if requiredorg.apache.solr.common.MapWriter
getPackageVersion(PluginInfo.ClassName cName)
<T> T
newInstance(String cname, Class<T> expectedType, String... subpackages)
<T> T
newInstance(String cname, Class<T> expectedType, String[] subPackages, Class<?>[] params, Object[] args)
Map<String,PackageAPI.PkgVersion>
packageDetails()
fetch the package versions of class namesString
packageName()
Name of the package or null to listen to all package changes
-
-
-
Constructor Detail
-
PackageListeningClassLoader
public PackageListeningClassLoader(CoreContainer coreContainer, org.apache.solr.common.cloud.SolrClassLoader fallbackClassLoader, Function<String,String> pkgVersionSupplier, Runnable onReload)
- Parameters:
fallbackClassLoader
- TheSolrClassLoader
to use if no package is specifiedpkgVersionSupplier
- Get the version configured for a given packageonReload
- The callback function that should be run if a package is updated
-
-
Method Detail
-
newInstance
public <T> T newInstance(String cname, Class<T> expectedType, String... subpackages)
- Specified by:
newInstance
in interfaceorg.apache.solr.common.cloud.SolrClassLoader
-
findPackageVersion
public SolrPackageLoader.SolrPackage.Version findPackageVersion(PluginInfo.ClassName cName, boolean registerListener)
This looks up for package and also listens for that package if required- Parameters:
cName
- The class name
-
getPackageVersion
public org.apache.solr.common.MapWriter getPackageVersion(PluginInfo.ClassName cName)
- Specified by:
getPackageVersion
in interfacePackageListeners.Listener
-
newInstance
public <T> T newInstance(String cname, Class<T> expectedType, String[] subPackages, Class<?>[] params, Object[] args)
- Specified by:
newInstance
in interfaceorg.apache.solr.common.cloud.SolrClassLoader
-
findClass
public <T> Class<? extends T> findClass(String cname, Class<T> expectedType)
- Specified by:
findClass
in interfaceorg.apache.solr.common.cloud.SolrClassLoader
-
packageName
public String packageName()
Description copied from interface:PackageListeners.Listener
Name of the package or null to listen to all package changes- Specified by:
packageName
in interfacePackageListeners.Listener
-
packageDetails
public Map<String,PackageAPI.PkgVersion> packageDetails()
Description copied from interface:PackageListeners.Listener
fetch the package versions of class names- Specified by:
packageDetails
in interfacePackageListeners.Listener
-
changed
public void changed(SolrPackageLoader.SolrPackage pkg, PackageListeners.Listener.Ctx ctx)
Description copied from interface:PackageListeners.Listener
A callback when the package is updated- Specified by:
changed
in interfacePackageListeners.Listener
-
doReloadAction
protected void doReloadAction(PackageListeners.Listener.Ctx ctx)
-
-