use of org.apache.helix.api.cloud.CloudInstanceInformationProcessor in project helix by apache.
the class ParticipantManager method getCloudInstanceInformation.
private CloudInstanceInformation getCloudInstanceInformation() {
String cloudInstanceInformationProcessorName = _helixManagerProperty.getHelixCloudProperty().getCloudInfoProcessorName();
try {
// fetch cloud instance information for the instance
String cloudInstanceInformationProcessorClassName = CLOUD_PROCESSOR_PATH_PREFIX + _helixManagerProperty.getHelixCloudProperty().getCloudProvider().toLowerCase() + "." + cloudInstanceInformationProcessorName;
Class processorClass = Class.forName(cloudInstanceInformationProcessorClassName);
Constructor constructor = processorClass.getConstructor(HelixCloudProperty.class);
CloudInstanceInformationProcessor processor = (CloudInstanceInformationProcessor) constructor.newInstance(_helixManagerProperty.getHelixCloudProperty());
List<String> responses = processor.fetchCloudInstanceInformation();
// parse cloud instance information for the participant
CloudInstanceInformation cloudInstanceInformation = processor.parseCloudInstanceInformation(responses);
return cloudInstanceInformation;
} catch (ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException ex) {
throw new HelixException("Failed to create a new instance for the class: " + cloudInstanceInformationProcessorName, ex);
}
}
Aggregations