java.lang.Object
   ↳ org.apache.helix.controller.GenericHelixController

Class Overview

Cluster Controllers main goal is to keep the cluster state as close as possible to Ideal State. It does this by listening to changes in cluster state and scheduling new tasks to get cluster state to best possible ideal state. Every instance of this class can control can control only one cluster Get all the partitions use IdealState, CurrentState and Messages
foreach partition
1. get the (instance,state) from IdealState, CurrentState and PendingMessages
2. compute best possible state (instance,state) pair. This needs previous step data and state model constraints
3. compute the messages/tasks needed to move to 1 to 2
4. select the messages that can be sent, needs messages and state model constraints
5. send messages

Summary

Public Constructors
GenericHelixController()
Default constructor that creates a default pipeline registry.
GenericHelixController(PipelineRegistry registry)
Public Methods
void onConfigChange(List<InstanceConfig> configs, NotificationContext changeContext)
Invoked when participant config changes
void onControllerChange(NotificationContext changeContext)
Invoked when controller changes
void onExternalViewChange(List<ExternalView> externalViewList, NotificationContext changeContext)
Invoked when external view changes
void onIdealStateChange(List<IdealState> idealStates, NotificationContext changeContext)
Invoed when ideal state changes
void onInstanceConfigChange(List<InstanceConfig> instanceConfigs, NotificationContext changeContext)
Invoked when participant config changes
void onLiveInstanceChange(List<LiveInstance> liveInstances, NotificationContext changeContext)
Invoked when live instance changes
void onMessage(String instanceName, List<Message> messages, NotificationContext changeContext)
Invoked when message changes
void onStateChange(String instanceName, List<CurrentState> statesInfo, NotificationContext changeContext)
Invoked when current state changes
void shutdownClusterStatusMonitor(String clusterName)
Protected Methods
void checkLiveInstancesObservation(List<LiveInstance> liveInstances, NotificationContext changeContext)
Go through the list of liveinstances in the cluster, and add currentstateChange listener and Message listeners to them if they are newly added.
synchronized void handleEvent(ClusterEvent event)
lock-always: caller always needs to obtain an external lock before call, calls to handleEvent() should be serialized
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.helix.ConfigChangeListener
From interface org.apache.helix.ControllerChangeListener
From interface org.apache.helix.CurrentStateChangeListener
From interface org.apache.helix.ExternalViewChangeListener
From interface org.apache.helix.IdealStateChangeListener
From interface org.apache.helix.InstanceConfigChangeListener
From interface org.apache.helix.LiveInstanceChangeListener
From interface org.apache.helix.MessageListener

Public Constructors

public GenericHelixController ()

Default constructor that creates a default pipeline registry. This is sufficient in most cases, but if there is a some thing specific needed use another constructor where in you can pass a pipeline registry

public GenericHelixController (PipelineRegistry registry)

Public Methods

public void onConfigChange (List<InstanceConfig> configs, NotificationContext changeContext)

Invoked when participant config changes

public void onControllerChange (NotificationContext changeContext)

Invoked when controller changes

Parameters
changeContext description of the event and state

public void onExternalViewChange (List<ExternalView> externalViewList, NotificationContext changeContext)

Invoked when external view changes

Parameters
externalViewList a list of ExternalViews
changeContext the change event and state

public void onIdealStateChange (List<IdealState> idealStates, NotificationContext changeContext)

Invoed when ideal state changes

public void onInstanceConfigChange (List<InstanceConfig> instanceConfigs, NotificationContext changeContext)

Invoked when participant config changes

public void onLiveInstanceChange (List<LiveInstance> liveInstances, NotificationContext changeContext)

Invoked when live instance changes

public void onMessage (String instanceName, List<Message> messages, NotificationContext changeContext)

Invoked when message changes

public void onStateChange (String instanceName, List<CurrentState> statesInfo, NotificationContext changeContext)

Invoked when current state changes

Parameters
instanceName name of the instance whose state changed
statesInfo a list of the current states
changeContext the change event and state

public void shutdownClusterStatusMonitor (String clusterName)

Protected Methods

protected void checkLiveInstancesObservation (List<LiveInstance> liveInstances, NotificationContext changeContext)

Go through the list of liveinstances in the cluster, and add currentstateChange listener and Message listeners to them if they are newly added. For current state change, the observation is tied to the session id of each live instance.

protected synchronized void handleEvent (ClusterEvent event)

lock-always: caller always needs to obtain an external lock before call, calls to handleEvent() should be serialized