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


Java NetUtils.addStaticResolution方法代码示例

本文整理汇总了Java中org.apache.hadoop.net.NetUtils.addStaticResolution方法的典型用法代码示例。如果您正苦于以下问题:Java NetUtils.addStaticResolution方法的具体用法?Java NetUtils.addStaticResolution怎么用?Java NetUtils.addStaticResolution使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.net.NetUtils的用法示例。


在下文中一共展示了NetUtils.addStaticResolution方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setConf

import org.apache.hadoop.net.NetUtils; //导入方法依赖的package包/类
public void setConf(Configuration conf) {
  if (conf instanceof JobConf) {
    this.conf = (JobConf) conf;
  } else {
    this.conf = new JobConf(conf);
  }
  this.mapOutputFile = ReflectionUtils.newInstance(
      conf.getClass(MRConfig.TASK_LOCAL_OUTPUT_CLASS,
        MROutputFiles.class, MapOutputFile.class), conf);
  this.lDirAlloc = new LocalDirAllocator(MRConfig.LOCAL_DIR);
  // add the static resolutions (this is required for the junit to
  // work on testcases that simulate multiple nodes on a single physical
  // node.
  String hostToResolved[] = conf.getStrings(MRConfig.STATIC_RESOLUTIONS);
  if (hostToResolved != null) {
    for (String str : hostToResolved) {
      String name = str.substring(0, str.indexOf('='));
      String resolvedName = str.substring(str.indexOf('=') + 1);
      NetUtils.addStaticResolution(name, resolvedName);
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:Task.java

示例2: testSetSocketAddress

import org.apache.hadoop.net.NetUtils; //导入方法依赖的package包/类
public void testSetSocketAddress() {
  Configuration conf = new Configuration();
  NetUtils.addStaticResolution("host", "127.0.0.1");
  final String defaultAddr = "host:1";
  
  InetSocketAddress addr = NetUtils.createSocketAddr(defaultAddr);    
  conf.setSocketAddr("myAddress", addr);
  assertEquals(defaultAddr, NetUtils.getHostPortString(addr));
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:10,代码来源:TestConfiguration.java

示例3: initializeDummyHostnameResolution

import org.apache.hadoop.net.NetUtils; //导入方法依赖的package包/类
@BeforeClass
public static void initializeDummyHostnameResolution() throws Exception {
  String previousIpAddress;
  for (String hostName : dummyHostNames) {
    if (null != (previousIpAddress = NetUtils.getStaticResolution(hostName))) {
      savedStaticResolution.put(hostName, previousIpAddress);
    }
    NetUtils.addStaticResolution(hostName, anyIpAddress);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:TestWebAppUtils.java

示例4: setUp

import org.apache.hadoop.net.NetUtils; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();
  NetUtils.addStaticResolution("host1", "172.0.0.1");
  NetUtils.addStaticResolution("host2", "172.0.0.1");
  NetUtils.addStaticResolution("host3", "172.0.0.1");
  NetUtils.addStaticResolution("host4", "172.0.0.1");
  NetUtils.addStaticResolution("host5", "172.0.0.1");
  NetUtils.addStaticResolution("host6", "172.0.0.1");
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:TestAmFilterInitializer.java

示例5: testSetSocketAddress

import org.apache.hadoop.net.NetUtils; //导入方法依赖的package包/类
public void testSetSocketAddress() throws IOException {
  Configuration conf = new Configuration();
  NetUtils.addStaticResolution("host", "127.0.0.1");
  final String defaultAddr = "host:1";
  
  InetSocketAddress addr = NetUtils.createSocketAddr(defaultAddr);    
  conf.setSocketAddr("myAddress", addr);
  assertEquals(defaultAddr, NetUtils.getHostPortString(addr));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:TestConfiguration.java

示例6: testSocketAddrWithName

import org.apache.hadoop.net.NetUtils; //导入方法依赖的package包/类
@Test
public void testSocketAddrWithName() {
  String staticHost = "my";
  NetUtils.addStaticResolution(staticHost, "localhost");
  verifyServiceAddr("LocalHost", "127.0.0.1");
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:7,代码来源:TestSecurityUtil.java

示例7: testSocketAddrWithIP

import org.apache.hadoop.net.NetUtils; //导入方法依赖的package包/类
@Test
public void testSocketAddrWithIP() {
  String staticHost = "127.0.0.1";
  NetUtils.addStaticResolution(staticHost, "localhost");
  verifyServiceAddr(staticHost, "127.0.0.1");
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:7,代码来源:TestSecurityUtil.java

示例8: testSocketAddrWithNameToStaticName

import org.apache.hadoop.net.NetUtils; //导入方法依赖的package包/类
@Test
public void testSocketAddrWithNameToStaticName() {
  String staticHost = "host1";
  NetUtils.addStaticResolution(staticHost, "localhost");
  verifyServiceAddr(staticHost, "127.0.0.1");
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:7,代码来源:TestSecurityUtil.java

示例9: testSocketAddrWithNameToStaticIP

import org.apache.hadoop.net.NetUtils; //导入方法依赖的package包/类
@Test
public void testSocketAddrWithNameToStaticIP() {
  String staticHost = "host3";
  NetUtils.addStaticResolution(staticHost, "255.255.255.255");
  verifyServiceAddr(staticHost, "255.255.255.255");
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:7,代码来源:TestSecurityUtil.java

示例10: testSocketAddrWithIPToStaticIP

import org.apache.hadoop.net.NetUtils; //导入方法依赖的package包/类
@Test
public void testSocketAddrWithIPToStaticIP() {
  String staticHost = "1.2.3.4";
  NetUtils.addStaticResolution(staticHost, "255.255.255.255");
  verifyServiceAddr(staticHost, "255.255.255.255");
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:7,代码来源:TestSecurityUtil.java

示例11: restoreDummyHostnameResolution

import org.apache.hadoop.net.NetUtils; //导入方法依赖的package包/类
@AfterClass
public static void restoreDummyHostnameResolution() throws Exception {
  for (Map.Entry<String, String> hostnameToIpEntry : savedStaticResolution.entrySet()) {
    NetUtils.addStaticResolution(hostnameToIpEntry.getKey(), hostnameToIpEntry.getValue());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:7,代码来源:TestWebAppUtils.java

示例12: setupStaticHostResolution

import org.apache.hadoop.net.NetUtils; //导入方法依赖的package包/类
/**
 * Add namenodes to the static resolution list to avoid going
 * through DNS which can be really slow in some configurations.
 */
private void setupStaticHostResolution(int nameServiceIdCount) {
  for (int i = 0; i < nameServiceIdCount; i++) {
    NetUtils.addStaticResolution("nn" + i, "localhost");
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:TestGetConf.java


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