use of com.github.ambry.server.AmbryHealthReport in project ambry by linkedin.
the class HelixParticipant method initialize.
/**
* Initialize the participant by registering via the {@link HelixManager} as a participant to the associated Helix
* cluster.
* @param hostName the hostname to use when registering as a participant.
* @param port the port to use when registering as a participant.
* @param ambryHealthReports {@link List} of {@link AmbryHealthReport} to be registered to the participant.
* @throws IOException if there is an error connecting to the Helix cluster.
*/
@Override
public void initialize(String hostName, int port, List<AmbryHealthReport> ambryHealthReports) throws IOException {
logger.info("Initializing participant");
instanceName = ClusterMapUtils.getInstanceName(hostName, port);
manager = helixFactory.getZKHelixManager(clusterName, instanceName, InstanceType.PARTICIPANT, zkConnectStr);
StateMachineEngine stateMachineEngine = manager.getStateMachineEngine();
stateMachineEngine.registerStateModelFactory(LeaderStandbySMD.name, new AmbryStateModelFactory());
registerHealthReportTasks(stateMachineEngine, ambryHealthReports);
try {
manager.connect();
} catch (Exception e) {
throw new IOException("Exception while connecting to the Helix manager", e);
}
for (AmbryHealthReport ambryHealthReport : ambryHealthReports) {
manager.getHealthReportCollector().addHealthReportProvider((HealthReportProvider) ambryHealthReport);
}
}
Aggregations