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);
}
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);
}
});
}
Aggregations