本文整理汇总了Java中org.apache.hadoop.registry.client.types.ServiceRecord.addExternalEndpoint方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceRecord.addExternalEndpoint方法的具体用法?Java ServiceRecord.addExternalEndpoint怎么用?Java ServiceRecord.addExternalEndpoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.registry.client.types.ServiceRecord
的用法示例。
在下文中一共展示了ServiceRecord.addExternalEndpoint方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addSampleEndpoints
import org.apache.hadoop.registry.client.types.ServiceRecord; //导入方法依赖的package包/类
/**
* Add some endpoints
* @param entry entry
*/
public static void addSampleEndpoints(ServiceRecord entry, String hostname)
throws URISyntaxException {
assertNotNull(hostname);
entry.addExternalEndpoint(webEndpoint(HTTP_API,
new URI("http", hostname + ":80", "/")));
entry.addExternalEndpoint(
restEndpoint(API_WEBHDFS,
new URI("http", hostname + ":8020", "/")));
Endpoint endpoint = ipcEndpoint(API_HDFS, null);
endpoint.addresses.add(RegistryTypeUtils.hostnamePortPair(hostname, 8030));
entry.addInternalEndpoint(endpoint);
InetSocketAddress localhost = new InetSocketAddress("localhost", 8050);
entry.addInternalEndpoint(
inetAddrEndpoint(NNIPC, ProtocolTypes.PROTOCOL_THRIFT, "localhost",
8050));
entry.addInternalEndpoint(
RegistryTypeUtils.ipcEndpoint(
IPC2, localhost));
}
示例2: registerHBaseServiceEntry
import org.apache.hadoop.registry.client.types.ServiceRecord; //导入方法依赖的package包/类
private void registerHBaseServiceEntry() throws IOException {
String name = amState.getApplicationName() ;
ServiceRecord serviceRecord = new ServiceRecord();
// bond lifespan to the application
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);
}
示例3: setupServiceRecord
import org.apache.hadoop.registry.client.types.ServiceRecord; //导入方法依赖的package包/类
private ServiceRecord setupServiceRecord() {
ServiceRecord application = new ServiceRecord();
application.set(YarnRegistryAttributes.YARN_ID, jstormMasterContext.appAttemptID.getApplicationId().toString());
application.description = JOYConstants.AM;
application.set(YarnRegistryAttributes.YARN_PERSISTENCE,
PersistencePolicies.PERMANENT);
Map<String, String> addresses = new HashMap<String, String>();
addresses.put(JOYConstants.HOST, jstormMasterContext.appMasterHostname);
addresses.put(JOYConstants.PORT, String.valueOf(jstormMasterContext.appMasterThriftPort));
Endpoint endpoint = new Endpoint(JOYConstants.HTTP, JOYConstants.HOST_PORT, JOYConstants.RPC, addresses);
application.addExternalEndpoint(endpoint);
return application;
}
示例4: applyInitialRegistryDefinitions
import org.apache.hadoop.registry.client.types.ServiceRecord; //导入方法依赖的package包/类
@Override
public void applyInitialRegistryDefinitions(URL amWebURI,
URL agentOpsURI,
URL agentStatusURI,
ServiceRecord serviceRecord)
throws IOException {
super.applyInitialRegistryDefinitions(amWebURI,
agentOpsURI,
agentStatusURI,
serviceRecord);
// now publish site.xml files
YarnConfiguration defaultYarnConfig = new YarnConfiguration();
amState.getPublishedSliderConfigurations().put(
PublishedArtifacts.COMPLETE_CONFIG,
new PublishedConfiguration(
"Complete slider application settings",
getConfig(), getConfig()));
amState.getPublishedSliderConfigurations().put(
PublishedArtifacts.YARN_SITE_CONFIG,
new PublishedConfiguration(
"YARN site settings",
ConfigHelper.loadFromResource("yarn-site.xml"),
defaultYarnConfig) );
amState.getPublishedSliderConfigurations().put(
PublishedArtifacts.CORE_SITE_CONFIG,
new PublishedConfiguration(
"Core site settings",
ConfigHelper.loadFromResource("core-site.xml"),
defaultYarnConfig) );
amState.getPublishedSliderConfigurations().put(
PublishedArtifacts.HDFS_SITE_CONFIG,
new PublishedConfiguration(
"HDFS site settings",
ConfigHelper.loadFromResource("hdfs-site.xml"),
new HdfsConfiguration(true)) );
try {
URL managementAPI = new URL(amWebURI, SLIDER_PATH_MANAGEMENT);
URL registryREST = new URL(amWebURI, SLIDER_PATH_REGISTRY );
URL publisherURL = new URL(amWebURI, SLIDER_PATH_PUBLISHER);
// Set the configurations URL.
String configurationsURL = SliderUtils.appendToURL(
publisherURL.toExternalForm(), RestPaths.SLIDER_CONFIGSET);
String exportsURL = SliderUtils.appendToURL(
publisherURL.toExternalForm(), RestPaths.SLIDER_EXPORTS);
serviceRecord.addExternalEndpoint(
RegistryTypeUtils.webEndpoint(
CustomRegistryConstants.WEB_UI, amWebURI.toURI()));
serviceRecord.addExternalEndpoint(
RegistryTypeUtils.restEndpoint(
CustomRegistryConstants.MANAGEMENT_REST_API,
managementAPI.toURI()));
serviceRecord.addExternalEndpoint(
RegistryTypeUtils.restEndpoint(
CustomRegistryConstants.PUBLISHER_REST_API,
publisherURL.toURI()));
serviceRecord.addExternalEndpoint(
RegistryTypeUtils.restEndpoint(
CustomRegistryConstants.REGISTRY_REST_API,
registryREST.toURI()));
serviceRecord.addExternalEndpoint(
RegistryTypeUtils.restEndpoint(
CustomRegistryConstants.PUBLISHER_CONFIGURATIONS_API,
new URI(configurationsURL)));
serviceRecord.addExternalEndpoint(
RegistryTypeUtils.restEndpoint(
CustomRegistryConstants.PUBLISHER_EXPORTS_API,
new URI(exportsURL)));
} catch (URISyntaxException e) {
throw new IOException(e);
}
}