public abstract class TriggerBase extends Object implements AutoScaling.Trigger
AutoScaling.Trigger implementations.
It handles state snapshot / restore in ZK.| Modifier and Type | Field and Description |
|---|---|
protected List<TriggerAction> |
actions |
protected SolrCloudManager |
cloudManager |
protected boolean |
enabled |
protected TriggerEventType |
eventType |
protected boolean |
isClosed |
protected Map<String,Object> |
lastState |
protected String |
name |
protected AtomicReference<AutoScaling.TriggerEventProcessor> |
processorRef |
protected Map<String,Object> |
properties |
protected DistribStateManager |
stateManager |
protected int |
waitForSecond |
| Modifier | Constructor and Description |
|---|---|
protected |
TriggerBase(TriggerEventType eventType,
String name,
Map<String,Object> properties,
SolrResourceLoader loader,
SolrCloudManager cloudManager) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
boolean |
equals(Object obj) |
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.
|
protected abstract Map<String,Object> |
getState()
Prepare and return internal state of this trigger in a format suitable for persisting in ZK.
|
int |
getWaitForSecond()
Number of seconds to wait between fired events ("waitFor" property).
|
int |
hashCode() |
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 |
saveState()
Save internal state of this trigger in ZooKeeper.
|
void |
setProcessor(AutoScaling.TriggerEventProcessor processor)
Set event processor to call when event is fired.
|
protected abstract void |
setState(Map<String,Object> state)
Restore internal state of this trigger from properties retrieved from ZK.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitrestoreStateprotected final String name
protected final SolrCloudManager cloudManager
protected final DistribStateManager stateManager
protected final TriggerEventType eventType
protected final int waitForSecond
protected final AtomicReference<AutoScaling.TriggerEventProcessor> processorRef
protected final List<TriggerAction> actions
protected final boolean enabled
protected boolean isClosed
protected TriggerBase(TriggerEventType eventType, String name, Map<String,Object> properties, SolrResourceLoader loader, SolrCloudManager cloudManager)
public void init()
AutoScaling.Triggerinit in interface AutoScaling.Triggerpublic void setProcessor(AutoScaling.TriggerEventProcessor processor)
AutoScaling.TriggersetProcessor in interface AutoScaling.Triggerpublic AutoScaling.TriggerEventProcessor getProcessor()
AutoScaling.TriggergetProcessor in interface AutoScaling.Triggerpublic String getName()
AutoScaling.TriggergetName in interface AutoScaling.Triggerpublic TriggerEventType getEventType()
AutoScaling.TriggergetEventType in interface AutoScaling.Triggerpublic boolean isEnabled()
AutoScaling.TriggerisEnabled in interface AutoScaling.Triggerpublic int getWaitForSecond()
AutoScaling.TriggergetWaitForSecond in interface AutoScaling.Triggerpublic Map<String,Object> getProperties()
AutoScaling.TriggergetProperties in interface AutoScaling.Triggerpublic List<TriggerAction> getActions()
AutoScaling.TriggergetActions in interface AutoScaling.Triggerpublic boolean isClosed()
AutoScaling.TriggerisClosed in interface AutoScaling.Triggerpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionprotected abstract Map<String,Object> getState()
Utils.toJSON(Object).protected abstract void setState(Map<String,Object> state)
state - never null but may be empty.public void saveState()
AutoScaling.TriggersaveState in interface AutoScaling.Triggerpublic void restoreState()
AutoScaling.TriggerrestoreState in interface AutoScaling.TriggerCopyright © 2000-2018 Apache Software Foundation. All Rights Reserved.