private void registerHBaseServiceEntry() throws IOException {
String name = amState.getApplicationName() ;
ServiceRecord serviceRecord = new ServiceRecord();
serviceRecord.set(YarnRegistryAttributes.YARN_ID,
yarnRegistry.getApplicationAttemptId()
.getApplicationId().toString());
serviceRecord.set(YarnRegistryAttributes.YARN_PERSISTENCE,
PersistencePolicies.APPLICATION);
try {
URL configURL = new URL(amWebAPI,
SLIDER_PATH_PUBLISHER + "/" + HBASE_SERVICE_TYPE);
serviceRecord.addExternalEndpoint(
RegistryTypeUtils.restEndpoint(
CustomRegistryConstants.PUBLISHER_CONFIGURATIONS_API,
configURL.toURI()));
} catch (URISyntaxException e) {
log.warn("failed to create config URL: {}", e, e);
}
log.info("registering {}/{}", name, HBASE_SERVICE_TYPE);
yarnRegistry.putService(HBASE_SERVICE_TYPE, name, serviceRecord, true);
PublishedConfiguration publishedSite =
new PublishedConfiguration("HBase site", siteConf);
PublishedConfigSet configSet =
amState.getOrCreatePublishedConfigSet(HBASE_SERVICE_TYPE);
configSet.put(HBASE_SITE_PUBLISHED_CONFIG, publishedSite);
}