public static interface AutoScaling.Trigger extends Closeable, Runnable
ScheduledExecutorService
so it is executed as
per a configured schedule to check whether the trigger is ready to fire. The setProcessor(AutoScaling.TriggerEventProcessor)
method should be used to set a processor which is used by implementation of this class whenever
ready.
As per the guarantees made by the ScheduledExecutorService
a trigger
implementation is only ever called sequentially and therefore need not be thread safe. However, it
is encouraged that implementations be immutable with the exception of the associated listener
which can be get/set by a different thread than the one executing the trigger. Therefore, implementations
should use appropriate synchronization around the listener.
When a trigger is ready to fire, it calls the AutoScaling.TriggerEventProcessor.process(TriggerEvent)
event
with the proper trigger event object. If that method returns false then it should be interpreted to mean
that Solr is not ready to process this trigger event and therefore we should retain the state and fire
at the next invocation of the run() method.
Modifier and Type | Method and 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.
|
List<TriggerAction> |
getActions()
Actions to execute when event is fired.
|
TriggerEventType |
getEventType()
Event type generated by this trigger.
|
String |
getName()
Trigger name.
|
AutoScaling.TriggerEventProcessor |
getProcessor()
Get event processor.
|
Map<String,Object> |
getProperties()
Trigger properties.
|
int |
getWaitForSecond()
Number of seconds to wait between fired events ("waitFor" property).
|
void |
init()
Called before a trigger is scheduled.
|
boolean |
isClosed()
Return true when this trigger is closed and cannot be used.
|
boolean |
isEnabled()
Returns true if this trigger is enabled.
|
void |
restoreState()
Restore internal state of this trigger from ZooKeeper.
|
void |
restoreState(AutoScaling.Trigger old)
Set internal state of this trigger from another instance.
|
void |
saveState()
Save internal state of this trigger in ZooKeeper.
|
void |
setProcessor(AutoScaling.TriggerEventProcessor processor)
Set event processor to call when event is fired.
|
String getName()
TriggerEventType getEventType()
boolean isEnabled()
int getWaitForSecond()
List<TriggerAction> getActions()
void setProcessor(AutoScaling.TriggerEventProcessor processor)
AutoScaling.TriggerEventProcessor getProcessor()
boolean isClosed()
void restoreState(AutoScaling.Trigger old)
void saveState()
void restoreState()
void configure(SolrResourceLoader loader, SolrCloudManager cloudManager, Map<String,Object> properties) throws TriggerValidationException
properties
- configuration propertiesTriggerValidationException
- contains details of invalid configuration parameters.Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.