use of org.apache.helix.NotificationContext in project ambry by linkedin.
the class MockHelixManager method triggerConfigChangeNotification.
void triggerConfigChangeNotification(boolean init) {
if (!isConnected) {
return;
}
NotificationContext notificationContext = new NotificationContext(this);
if (init) {
notificationContext.setType(NotificationContext.Type.INIT);
}
instanceConfigChangeListeners.forEach(listener -> listener.onInstanceConfigChange(mockAdmin.getInstanceConfigs(clusterName), notificationContext));
}
use of org.apache.helix.NotificationContext in project ambry by linkedin.
the class MockHelixManager method triggerLiveInstanceNotification.
/**
* Trigger a live instance change notification.
*/
void triggerLiveInstanceNotification(boolean init) {
List<LiveInstance> liveInstances = new ArrayList<>();
for (String instance : mockAdmin.getUpInstances()) {
liveInstances.add(new LiveInstance(instance));
}
NotificationContext notificationContext = new NotificationContext(this);
if (init) {
notificationContext.setType(NotificationContext.Type.INIT);
}
liveInstanceChangeListener.onLiveInstanceChange(liveInstances, notificationContext);
}
use of org.apache.helix.NotificationContext in project ambry by linkedin.
the class MockHelixManager method triggerIdealStateNotification.
void triggerIdealStateNotification(boolean init) throws InterruptedException {
NotificationContext notificationContext = new NotificationContext(this);
if (init) {
notificationContext.setType(NotificationContext.Type.INIT);
}
idealStateChangeListener.onIdealStateChange(mockAdmin.getIdealStates(), notificationContext);
}
use of org.apache.helix.NotificationContext 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.NotificationContext 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