public abstract class AbstractFeature extends Object implements Feature
| Constructor and Description |
|---|
AbstractFeature()
Construct the feature, setting the feature name based on the Java class name.
|
AbstractFeature(String featureName)
Construct this feature, with the provided feature name
|
| Modifier and Type | Method and Description |
|---|---|
<T extends Component> |
findByType(String componentType)
Find a list of components by type name
|
<T extends Component> |
findByType(String componentType,
T defaultValue)
Finds the a registered component by type name.
|
void |
finish(Server server)
Called by Helix Server when the server going to stop.
|
String |
getFeatureName()
Get this feature's name for debugging and logging
|
com.google.common.collect.Multimap<String,Component> |
getRegistrationMap()
Returns a map of registered components owned by this feature
|
void |
logFeatureDetails(org.slf4j.Logger logger)
Logs the feature configuration to the provided logger.
|
void |
register(Component... componentArray)
Register component(s) created and owned by this feature
|
void |
start(Server server)
Called by Helix Server when the server is starting.
|
void |
stop(Server server)
Called by Helix Server when the server has stopped.
|
public AbstractFeature()
public AbstractFeature(String featureName)
featureName - Feature namepublic String getFeatureName()
getFeatureName in interface Featurepublic void register(Component... componentArray)
Components registered here are in a registry local to this feature. These components will also be automatically aggregated and registered with the HelixServer top-level registry.
If a component contains other components, then the entire tree of components will be registered.
componentArray - Array of components to registerpublic com.google.common.collect.Multimap<String,Component> getRegistrationMap()
getRegistrationMap in interface ComponentRegistrypublic <T extends Component> Collection<T> findByType(String componentType)
findByType in interface ComponentRegistryT - Resulting class of the components expectedcomponentType - Type name of the components to findpublic <T extends Component> T findByType(String componentType, T defaultValue)
findByType in interface ComponentRegistryT - Resulting class of the component expectedcomponentType - Type name of the component to finddefaultValue - Default component if none is found (null is okay)public void logFeatureDetails(org.slf4j.Logger logger)
This implements a generic way of logging features, so subclasses should not need to implement their own logging code.
logFeatureDetails in interface Featurelogger - Logger to write the feature details topublic void start(Server server)
The order features will be called is the same order they initially registered with Helix. At the time this method is called, Vert.x will be initialized enabling the feature to create any Vert.x related resources.
Features should create and register any singleton components and allocate resources during the start call. Blocking operations are allowed in this method.
public void finish(Server server)
The order features will be called is the reverse order they initially registered with Helix. Features should NOT release resources at this point.
Stop accepting new requests, and finish all ongoing requests. There will be a configurable delay between the finish and stop lifecycle callbacks to enable the server to finish in-flight requests.
public void stop(Server server)
The order features will be called is the reverse order they initially registered with Helix. Features must release all owned resources at this point. Blocking operations are allowed in this method.
Copyright © 2016. All rights reserved.