• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RegistryUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.registry.client.binding.RegistryUtils的典型用法代码示例。如果您正苦于以下问题:Java RegistryUtils类的具体用法?Java RegistryUtils怎么用?Java RegistryUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RegistryUtils类属于org.apache.hadoop.registry.client.binding包,在下文中一共展示了RegistryUtils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testLsParent

import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入依赖的package包/类
@Test
public void testLsParent() throws Throwable {
  ServiceRecord written = putExampleServiceEntry(ENTRY_PATH, 0);
  RegistryPathStatus stat = operations.stat(ENTRY_PATH);

  List<String> children = operations.list(PARENT_PATH);
  assertEquals(1, children.size());
  assertEquals(NAME, children.get(0));
  Map<String, RegistryPathStatus> childStats =
      RegistryUtils.statChildren(operations, PARENT_PATH);
  assertEquals(1, childStats.size());
  assertEquals(stat, childStats.get(NAME));

  Map<String, ServiceRecord> records =
      RegistryUtils.extractServiceRecords(operations,
          PARENT_PATH,
          childStats.values());
  assertEquals(1, records.size());
  ServiceRecord record = records.get(ENTRY_PATH);
  RegistryTypeUtils.validateServiceRecord(ENTRY_PATH, record);
  assertMatches(written, record);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestRegistryOperations.java


示例2: testComplexUsernames

import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入依赖的package包/类
@Test
public void testComplexUsernames() throws Throwable {
  operations.mknode("/users/user with spaces", true);
  operations.mknode("/users/user-with_underscores", true);
  operations.mknode("/users/000000", true);
  operations.mknode("/users/-storm", true);
  operations.mknode("/users/windows\\ user", true);
  String home = RegistryUtils.homePathForUser("\u0413PA\u0414_3");
  operations.mknode(home, true);
  operations.mknode(
      RegistryUtils.servicePath(home, "service.class", "service 4_5"),
      true);

  operations.mknode(
      RegistryUtils.homePathForUser("[email protected]"),
      true);
  operations.mknode(
      RegistryUtils.homePathForUser("hbase/[email protected]"),
      true);
  home = RegistryUtils.homePathForUser("ADMINISTRATOR/127.0.0.1");
  assertTrue("No 'administrator' in " + home, home.contains("administrator"));
  operations.mknode(
      home,
      true);

}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:TestRegistryOperations.java


示例3: needUpgrade

import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入依赖的package包/类
public boolean needUpgrade() {
    String containerPath = RegistryUtils.componentPath(
            JOYConstants.APP_TYPE, this.executorMeta.getInstanceName(),
            this.executorMeta.getApplicationId(), this.executorMeta.getRunningContainer());

    try {
        if (registryOperations.exists(containerPath)) {
            ServiceRecord sr = registryOperations.resolve(containerPath);
            if (sr.get(JOYConstants.NEED_UPGRADE) != null && sr.get(JOYConstants.NEED_UPGRADE).equals(JOYConstants.TRUE)) {
                sr.set(JOYConstants.NEED_UPGRADE, JOYConstants.FALSE);
                registryOperations.bind(containerPath, sr, BindFlags.OVERWRITE);
                LOG.info(JOYConstants.NEED_UPGRADE);
                return true;
            }
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    return false;
}
 
开发者ID:alibaba,项目名称:jstorm,代码行数:21,代码来源:Executor.java


示例4: getSupervisorSlotPorts

import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入依赖的package包/类
public String getSupervisorSlotPorts(int memory, int vcores, String supervisorHost) throws Exception {

        String hostPath = RegistryUtils.servicePath(
                JOYConstants.APP_TYPE, this.instanceName, supervisorHost);

        tryHostLock(hostPath);
        try {
            List<String> relist;
            int slotCount = getSlotCount(memory, vcores);

            LOG.info("slotCount:" + slotCount);
            relist = getSetPortUsedBySupervisor(supervisorHost, slotCount);
            LOG.info("get ports string:" + JstormYarnUtils.join(relist, JOYConstants.COMMA, false));

            return JstormYarnUtils.join(relist, JOYConstants.COMMA, false);
        } catch (Exception e) {
            LOG.error(e);
            throw e;
        } finally {
            releaseHostLock(hostPath);
        }
    }
 
开发者ID:alibaba,项目名称:jstorm,代码行数:23,代码来源:SlotPortsView.java


示例5: testListListFully

import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入依赖的package包/类
@Test
public void testListListFully() throws Throwable {
  ServiceRecord r1 = new ServiceRecord();
  ServiceRecord r2 = createRecord("i",
      PersistencePolicies.PERMANENT, "r2");

  String path = USERPATH + SC_HADOOP + "/listing" ;
  operations.mknode(path, true);
  String r1path = path + "/r1";
  operations.bind(r1path, r1, 0);
  String r2path = path + "/r2";
  operations.bind(r2path, r2, 0);

  RegistryPathStatus r1stat = operations.stat(r1path);
  assertEquals("r1", r1stat.path);
  RegistryPathStatus r2stat = operations.stat(r2path);
  assertEquals("r2", r2stat.path);
  assertNotEquals(r1stat, r2stat);

  // listings now
  List<String> list = operations.list(path);
  assertEquals("Wrong no. of children", 2, list.size());
  // there's no order here, so create one
  Map<String, String> names = new HashMap<String, String>();
  String entries = "";
  for (String child : list) {
    names.put(child, child);
    entries += child + " ";
  }
  assertTrue("No 'r1' in " + entries,
      names.containsKey("r1"));
  assertTrue("No 'r2' in " + entries,
      names.containsKey("r2"));

  Map<String, RegistryPathStatus> stats =
      RegistryUtils.statChildren(operations, path);
  assertEquals("Wrong no. of children", 2, stats.size());
  assertEquals(r1stat, stats.get("r1"));
  assertEquals(r2stat, stats.get("r2"));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:41,代码来源:TestRegistryOperations.java


示例6: NRegistryOperator

import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入依赖的package包/类
public NRegistryOperator(String appIdAsName, Configuration conf) {
  this.conf = conf;
  this.appIdAsName = appIdAsName;
  this.user = RegistryUtils.currentUser();
  createRegistryOperationsInstance();
  initServiceRecord();
}
 
开发者ID:intel-hadoop,项目名称:yacop,代码行数:8,代码来源:NRegistryOperator.java


示例7: deleteApp

import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入依赖的package包/类
public void deleteApp() {
  try {
    String path = RegistryUtils.servicePath(user, serviceClass, appIdAsName);
    boolean exists = registryOperations.exists(path);
    if (exists) {
      registryOperations.delete(path, true);
    } else {
      LOG.info(path + " cannot be found");
    }
  } catch (IOException e) {
    e.printStackTrace();
  }
}
 
开发者ID:intel-hadoop,项目名称:yacop,代码行数:14,代码来源:NRegistryOperator.java


示例8: resolveApp

import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入依赖的package包/类
public ServiceRecord resolveApp() throws IOException {
  String path = RegistryUtils.servicePath(user, serviceClass, appIdAsName);
  boolean exists = registryOperations.exists(path);
  if (exists) {
    ServiceRecord record = registryOperations.resolve(path);
    return record;
  } else {
    LOG.info(path + " cannot be found");
    return null;
  }
}
 
开发者ID:intel-hadoop,项目名称:yacop,代码行数:12,代码来源:NRegistryOperator.java


示例9: listYacopApps

import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入依赖的package包/类
public List<String> listYacopApps() throws IOException {
  String path = RegistryUtils.serviceclassPath(user, serviceClass);
  boolean exists = registryOperations.exists(path);
  if (exists) {
    List<String> appIds = registryOperations.list(path);
    return appIds;
  } else {
    LOG.info(path + " cannot be found");
    return new ArrayList<String>();
  }
}
 
开发者ID:intel-hadoop,项目名称:yacop,代码行数:12,代码来源:NRegistryOperator.java


示例10: deleteContainer

import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入依赖的package包/类
public void deleteContainer(String containerIdAsName) {
  try {
    String path = RegistryUtils.componentPath(user, serviceClass, appIdAsName, containerIdAsName);
    boolean exists = registryOperations.exists(path);
    if (exists) {
      registryOperations.delete(path, false);
    } else {
      LOG.info(path + " cannot be found");
    }
  } catch (IOException e) {
    e.printStackTrace();
  }

}
 
开发者ID:intel-hadoop,项目名称:yacop,代码行数:15,代码来源:NRegistryOperator.java


示例11: resolveContainer

import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入依赖的package包/类
public ServiceRecord resolveContainer(String containerIdAsName) throws IOException {
  String path = RegistryUtils.componentPath(user, serviceClass, appIdAsName, containerIdAsName);
  boolean exists = registryOperations.exists(path);
  if (exists) {
    ServiceRecord record = registryOperations.resolve(path);
    return record;
  } else {
    LOG.info(path + " cannot be found");
    return null;
  }
}
 
开发者ID:intel-hadoop,项目名称:yacop,代码行数:12,代码来源:NRegistryOperator.java


示例12: resolveContainers

import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入依赖的package包/类
public Map<String, ServiceRecord> resolveContainers() throws IOException {
  Map<String, ServiceRecord> records = new HashMap<String, ServiceRecord>();

  List<String> containerIds = listAllContainers();
  if (containerIds.isEmpty()) {
    return null;
  }

  for (String containerId : containerIds) {
    String path = RegistryUtils.componentPath(user, serviceClass, appIdAsName, containerId);
    ServiceRecord record = registryOperations.resolve(path);
    records.put(containerId, record);
  }
  return records;
}
 
开发者ID:intel-hadoop,项目名称:yacop,代码行数:16,代码来源:NRegistryOperator.java


示例13: listAllContainers

import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入依赖的package包/类
public List<String> listAllContainers() throws IOException {
  String path = RegistryUtils.componentListPath(user, serviceClass, appIdAsName);
  boolean exists = registryOperations.exists(path);
  if (exists) {
    List<String> containerIds = registryOperations.list(path);
    return containerIds;
  } else {
    LOG.info(path + " cannot be found");
    return new ArrayList<String>();
  }

}
 
开发者ID:intel-hadoop,项目名称:yacop,代码行数:13,代码来源:NRegistryOperator.java


示例14: putComponent

import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入依赖的package包/类
/**
 * Add a component 
 * @param serviceClass service class to use under ~user
 * @param componentName component name
 * @param record record to put
 * @throws IOException
 */
public void putComponent(String serviceClass,
    String serviceName,
    String componentName,
    ServiceRecord record) throws IOException {
  String path = RegistryUtils.componentPath(
      user, serviceClass, serviceName, componentName);
  registryOperations.mknode(RegistryPathUtils.parentOf(path), true);
  registryOperations.bind(path, record, BindFlags.OVERWRITE);
}
 
开发者ID:apache,项目名称:incubator-slider,代码行数:17,代码来源:YarnRegistryViewForProviders.java


示例15: putService

import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入依赖的package包/类
/**
 * Add a service under a path, optionally purging any history
 * @param username user
 * @param serviceClass service class to use under ~user
 * @param serviceName name of the service
 * @param record service record
 * @param deleteTreeFirst perform recursive delete of the path first.
 * @return the path the service was created at
 * @throws IOException
 */
public String putService(String username,
    String serviceClass,
    String serviceName,
    ServiceRecord record,
    boolean deleteTreeFirst) throws IOException {
  String path = RegistryUtils.servicePath(
      username, serviceClass, serviceName);
  if (deleteTreeFirst) {
    registryOperations.delete(path, true);
  }
  registryOperations.mknode(RegistryPathUtils.parentOf(path), true);
  registryOperations.bind(path, record, BindFlags.OVERWRITE);
  return path;
}
 
开发者ID:apache,项目名称:incubator-slider,代码行数:25,代码来源:YarnRegistryViewForProviders.java


示例16: deleteComponent

import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入依赖的package包/类
/**
 * Delete a component
 * @param componentName component name
 * @throws IOException
 */
public void deleteComponent(String componentName) throws IOException {
  String path = RegistryUtils.componentPath(
      user, sliderServiceClass, instanceName,
      componentName);
  registryOperations.delete(path, false);
}
 
开发者ID:apache,项目名称:incubator-slider,代码行数:12,代码来源:YarnRegistryViewForProviders.java


示例17: resolvePath

import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入依赖的package包/类
/**
 * Process a path expanding it if needed.
 * Validation is delegated to later as the core registry will need
 * to do that anyway
 * @param path path
 * @return a path maybe with some expansion
 */
public static String resolvePath(String path) {
  Preconditions.checkArgument(path!=null, "null path");
  Preconditions.checkArgument(!path.isEmpty(), "empty path");
  String newpath = path;
  if (path.startsWith("~/")) {
    // add user expansion
    newpath = RegistryUtils.homePathForCurrentUser() + path.substring(1);
  } else if (path.equals("~")) {
    newpath = RegistryUtils.homePathForCurrentUser();
  }
  return newpath;
}
 
开发者ID:apache,项目名称:incubator-slider,代码行数:20,代码来源:SliderRegistryUtils.java


示例18: setupInitialRegistryPaths

import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入依赖的package包/类
/**
 * TODO: purge this once RM is doing the work
 *
 * @throws IOException
 */
protected void setupInitialRegistryPaths() throws IOException {
    if (registryOperations instanceof RMRegistryOperationsService) {
        RMRegistryOperationsService rmRegOperations =
                (RMRegistryOperationsService) registryOperations;
        rmRegOperations.initUserRegistryAsync(RegistryUtils.currentUser());
    }
}
 
开发者ID:alibaba,项目名称:jstorm,代码行数:13,代码来源:Executor.java


示例19: deleteComponent

import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入依赖的package包/类
/**
 * Delete a component
 * @param componentName component name
 * @throws IOException
 */
public void deleteComponent(String componentName) throws IOException {
  String path = RegistryUtils.componentPath(
      user, jstormServiceClass, instanceName,
      componentName);
  registryOperations.delete(path, false);
}
 
开发者ID:alibaba,项目名称:jstorm,代码行数:12,代码来源:YarnRegistryViewForProviders.java


示例20: putService

import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入依赖的package包/类
private void putService() throws IOException {
  String path = RegistryUtils.servicePath(user, serviceClass, appIdAsName);
  registryOperations.mknode(RegistryPathUtils.parentOf(path), true);
  registryOperations.bind(path, appRecord, BindFlags.OVERWRITE);
}
 
开发者ID:intel-hadoop,项目名称:yacop,代码行数:6,代码来源:NRegistryOperator.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LocalQuickFixProvider类代码示例发布时间:2022-05-23
下一篇:
Java ClientException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap