当前位置: 首页>>代码示例>>Java>>正文


Java ServiceRecord.addExternalEndpoint方法代码示例

本文整理汇总了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));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:RegistryTestHelper.java

示例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);    
  }
 
开发者ID:apache,项目名称:incubator-slider,代码行数:32,代码来源:HBaseProviderService.java

示例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;
}
 
开发者ID:alibaba,项目名称:jstorm,代码行数:14,代码来源:JstormMaster.java

示例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);
  }
}
 
开发者ID:apache,项目名称:incubator-slider,代码行数:81,代码来源:SliderAMProviderService.java


注:本文中的org.apache.hadoop.registry.client.types.ServiceRecord.addExternalEndpoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。