Class ScheduledTrigger
- java.lang.Object
-
- org.apache.solr.cloud.autoscaling.TriggerBase
-
- org.apache.solr.cloud.autoscaling.ScheduledTrigger
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Runnable
,AutoScaling.Trigger
public class ScheduledTrigger extends TriggerBase
A trigger which createsTriggerEventType.SCHEDULED
events as per the configured schedule
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ScheduledTrigger.ScheduledEvent
-
Field Summary
-
Fields inherited from class org.apache.solr.cloud.autoscaling.TriggerBase
actions, cloudManager, enabled, eventType, isClosed, lastState, loader, name, processorRef, properties, requiredProperties, stateManager, validProperties, waitForSecond
-
-
Constructor Summary
Constructors Constructor Description ScheduledTrigger(String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configure(SolrResourceLoader loader, SolrCloudManager cloudManager, Map<String,Object> properties)
Called when trigger is created but before it's initialized or scheduled for use.protected Map<String,Object>
getState()
Prepare and return internal state of this trigger in a format suitable for persisting in ZK.void
restoreState(AutoScaling.Trigger old)
Set internal state of this trigger from another instance.void
run()
protected void
setState(Map<String,Object> state)
Restore internal state of this trigger from properties retrieved from ZK.-
Methods inherited from class org.apache.solr.cloud.autoscaling.TriggerBase
close, deepCopyState, equals, getActions, getEventType, getName, getProcessor, getProperties, getWaitForSecond, hashCode, init, isClosed, isEnabled, restoreState, saveState, setProcessor
-
-
-
-
Constructor Detail
-
ScheduledTrigger
public ScheduledTrigger(String name)
-
-
Method Detail
-
configure
public void configure(SolrResourceLoader loader, SolrCloudManager cloudManager, Map<String,Object> properties) throws TriggerValidationException
Description copied from interface:AutoScaling.Trigger
Called when trigger is created but before it's initialized or scheduled for use. This method should also verify that the trigger configuration parameters are correct. It may be called multiple times.- Specified by:
configure
in interfaceAutoScaling.Trigger
- Overrides:
configure
in classTriggerBase
properties
- configuration properties- Throws:
TriggerValidationException
- contains details of invalid configuration parameters.
-
getState
protected Map<String,Object> getState()
Description copied from class:TriggerBase
Prepare and return internal state of this trigger in a format suitable for persisting in ZK.- Specified by:
getState
in classTriggerBase
- Returns:
- map of internal state properties. Note: values must be supported by
Utils.toJSON(Object)
.
-
setState
protected void setState(Map<String,Object> state)
Description copied from class:TriggerBase
Restore internal state of this trigger from properties retrieved from ZK.- Specified by:
setState
in classTriggerBase
- Parameters:
state
- never null but may be empty.
-
restoreState
public void restoreState(AutoScaling.Trigger old)
Description copied from interface:AutoScaling.Trigger
Set internal state of this trigger from another instance.
-
run
public void run()
-
-