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 SolrCloudManager
cloudManager
protected AutoScalingConfig.TriggerListenerConfig
config
protected boolean
enabled
protected SolrResourceLoader
loader
protected Set<String>
requiredProperties
Set of required property names.protected Set<String>
validProperties
Set of valid property names.protected Set<String>
validPropertyPrefixes
Subclasses 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 protected
TriggerListenerBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
configure(SolrResourceLoader loader, SolrCloudManager cloudManager, AutoScalingConfig.TriggerListenerConfig config)
Called when listener is created but before it's initialized and used.AutoScalingConfig.TriggerListenerConfig
getConfig()
void
init()
boolean
isEnabled()
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:TriggerListener
Called 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:
configure
in 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:
getConfig
in interfaceTriggerListener
-
isEnabled
public boolean isEnabled()
Description copied from interface:TriggerListener
If this method returns false then the listener'sTriggerListener.onEvent(TriggerEvent, TriggerEventProcessorStage, String, ActionContext, Throwable, String)
method should not be called.- Specified by:
isEnabled
in interfaceTriggerListener
-
init
public void init() throws Exception
- Specified by:
init
in interfaceTriggerListener
- Throws:
Exception
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-