Class TriggerListenerBase
- java.lang.Object
-
- org.apache.solr.cloud.autoscaling.TriggerListenerBase
-
- All Implemented Interfaces:
Closeable,AutoCloseable,TriggerListener
- Direct Known Subclasses:
HttpTriggerListener,LoggingListener,SystemLogListener
public abstract class TriggerListenerBase extends Object implements TriggerListener
Base class for implementations ofTriggerListener.
-
-
Field Summary
Fields Modifier and Type Field Description protected SolrCloudManagercloudManagerprotected AutoScalingConfig.TriggerListenerConfigconfigprotected booleanenabledprotected SolrResourceLoaderloaderprotected Set<String>requiredPropertiesSet of required property names.protected Set<String>validPropertiesSet of valid property names.protected Set<String>validPropertyPrefixesSubclasses can add to this set if they want to allow arbitrary properties that start with one of valid prefixes.
-
Constructor Summary
Constructors Modifier Constructor Description protectedTriggerListenerBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidconfigure(SolrResourceLoader loader, SolrCloudManager cloudManager, AutoScalingConfig.TriggerListenerConfig config)Called when listener is created but before it's initialized and used.AutoScalingConfig.TriggerListenerConfiggetConfig()voidinit()booleanisEnabled()If this method returns false then the listener'sTriggerListener.onEvent(TriggerEvent, TriggerEventProcessorStage, String, ActionContext, Throwable, String)method should not be called.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.solr.cloud.autoscaling.TriggerListener
onEvent
-
-
-
-
Field Detail
-
config
protected AutoScalingConfig.TriggerListenerConfig config
-
cloudManager
protected SolrCloudManager cloudManager
-
loader
protected SolrResourceLoader loader
-
enabled
protected boolean enabled
-
validProperties
protected final Set<String> validProperties
Set of valid property names. Subclasses may add to this set usingTriggerUtils.validProperties(Set, String...)
-
requiredProperties
protected final Set<String> requiredProperties
Set of required property names. Subclasses may add to this set usingTriggerUtils.requiredProperties(Set, Set, String...)(required properties are also valid properties).
-
-
Method Detail
-
configure
public void configure(SolrResourceLoader loader, SolrCloudManager cloudManager, AutoScalingConfig.TriggerListenerConfig config) throws TriggerValidationException
Description copied from interface:TriggerListenerCalled when listener is created but before it's initialized and used. This method should also verify that the configuration parameters are correct. It may be called multiple times.- Specified by:
configurein interfaceTriggerListener- Parameters:
loader- loader to use for instantiating sub-componentscloudManager- current instance of SolrCloudManagerconfig- coniguration- Throws:
TriggerValidationException- contains details of invalid configuration parameters.
-
getConfig
public AutoScalingConfig.TriggerListenerConfig getConfig()
- Specified by:
getConfigin interfaceTriggerListener
-
isEnabled
public boolean isEnabled()
Description copied from interface:TriggerListenerIf this method returns false then the listener'sTriggerListener.onEvent(TriggerEvent, TriggerEventProcessorStage, String, ActionContext, Throwable, String)method should not be called.- Specified by:
isEnabledin interfaceTriggerListener
-
init
public void init() throws Exception- Specified by:
initin interfaceTriggerListener- Throws:
Exception
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-