Search in sources :

Example 1 with ControllerChangeListener

use of org.apache.helix.ControllerChangeListener in project pinot by linkedin.

the class PinotRealtimeSegmentManager method start.

public void start(ControllerMetrics controllerMetrics) {
    _controllerMetrics = controllerMetrics;
    LOGGER.info("Starting realtime segments manager, adding a listener on the property store table configs path.");
    String zkUrl = _pinotHelixResourceManager.getHelixZkURL();
    _zkClient = new ZkClient(zkUrl, ZkClient.DEFAULT_SESSION_TIMEOUT, ZkClient.DEFAULT_CONNECTION_TIMEOUT);
    _zkClient.setZkSerializer(new ZNRecordSerializer());
    _zkClient.waitUntilConnected();
    // Subscribe to any data/child changes to property
    _zkClient.subscribeChildChanges(_tableConfigPath, this);
    _zkClient.subscribeDataChanges(_tableConfigPath, this);
    // Subscribe to leadership changes
    _pinotHelixResourceManager.getHelixZkManager().addControllerListener(new ControllerChangeListener() {

        @Override
        public void onControllerChange(NotificationContext changeContext) {
            processPropertyStoreChange(CONTROLLER_LEADER_CHANGE);
        }
    });
    // Setup change listeners for already existing tables, if any.
    processPropertyStoreChange(_tableConfigPath);
}
Also used : ZkClient(org.apache.helix.manager.zk.ZkClient) NotificationContext(org.apache.helix.NotificationContext) ControllerChangeListener(org.apache.helix.ControllerChangeListener) ZNRecordSerializer(org.apache.helix.manager.zk.ZNRecordSerializer)

Example 2 with ControllerChangeListener

use of org.apache.helix.ControllerChangeListener in project pinot by linkedin.

the class SegmentStatusChecker method start.

/**
   * Starts the segment status checker.
   */
public void start(ControllerMetrics metricsRegistry) {
    if (_segmentStatusIntervalSeconds == -1) {
        return;
    }
    _metricsRegistry = metricsRegistry;
    setStatusToDefault();
    // Subscribe to leadership changes
    _pinotHelixResourceManager.getHelixZkManager().addControllerListener(new ControllerChangeListener() {

        @Override
        public void onControllerChange(NotificationContext changeContext) {
            processLeaderChange(CONTROLLER_LEADER_CHANGE);
        }
    });
}
Also used : NotificationContext(org.apache.helix.NotificationContext) ControllerChangeListener(org.apache.helix.ControllerChangeListener)

Aggregations

ControllerChangeListener (org.apache.helix.ControllerChangeListener)2 NotificationContext (org.apache.helix.NotificationContext)2 ZNRecordSerializer (org.apache.helix.manager.zk.ZNRecordSerializer)1 ZkClient (org.apache.helix.manager.zk.ZkClient)1