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


Java ServerName.getHostname方法代码示例

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


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

示例1: reorderBlocks

import org.apache.hadoop.hbase.ServerName; //导入方法依赖的package包/类
public void reorderBlocks(Configuration conf, LocatedBlocks lbs, String src)
    throws IOException {

  ServerName sn = DefaultWALProvider.getServerNameFromWALDirectoryName(conf, src);
  if (sn == null) {
    // It's not an WAL
    return;
  }

  // Ok, so it's an WAL
  String hostName = sn.getHostname();
  if (LOG.isTraceEnabled()) {
    LOG.trace(src +
        " is an WAL file, so reordering blocks, last hostname will be:" + hostName);
  }

  // Just check for all blocks
  for (LocatedBlock lb : lbs.getLocatedBlocks()) {
    DatanodeInfo[] dnis = lb.getLocations();
    if (dnis != null && dnis.length > 1) {
      boolean found = false;
      for (int i = 0; i < dnis.length - 1 && !found; i++) {
        if (hostName.equals(dnis[i].getHostName())) {
          // advance the other locations by one and put this one at the last place.
          DatanodeInfo toLast = dnis[i];
          System.arraycopy(dnis, i + 1, dnis, i, dnis.length - i - 1);
          dnis[dnis.length - 1] = toLast;
          found = true;
        }
      }
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:34,代码来源:HFileSystem.java

示例2: RpcChannelImplementation

import org.apache.hadoop.hbase.ServerName; //导入方法依赖的package包/类
/**
 * @param channelOperationTimeout - the default timeout when no timeout is given
 */
protected RpcChannelImplementation(final AsyncRpcClient rpcClient,
    final ServerName sn, final User ticket, int channelOperationTimeout) {
  this.isa = new InetSocketAddress(sn.getHostname(), sn.getPort());
  this.rpcClient = rpcClient;
  this.ticket = ticket;
  this.channelOperationTimeout = channelOperationTimeout;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:11,代码来源:AsyncRpcClient.java

示例3: BlockingRpcChannelImplementation

import org.apache.hadoop.hbase.ServerName; //导入方法依赖的package包/类
/**
 * @param channelOperationTimeout - the default timeout when no timeout is given
 */
protected BlockingRpcChannelImplementation(final AbstractRpcClient rpcClient,
    final ServerName sn, final User ticket, int channelOperationTimeout) {
  this.isa = new InetSocketAddress(sn.getHostname(), sn.getPort());
  this.rpcClient = rpcClient;
  this.ticket = ticket;
  this.channelOperationTimeout = channelOperationTimeout;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:11,代码来源:AbstractRpcClient.java

示例4: checkTableInfo

import org.apache.hadoop.hbase.ServerName; //导入方法依赖的package包/类
void checkTableInfo(TableInfoModel model) {
  assertEquals(model.getName(), TABLE.getNameAsString());
  Iterator<TableRegionModel> regions = model.getRegions().iterator();
  assertTrue(regions.hasNext());
  while (regions.hasNext()) {
    TableRegionModel region = regions.next();
    boolean found = false;
    for (HRegionLocation e: regionMap) {
      HRegionInfo hri = e.getRegionInfo();
      String hriRegionName = hri.getRegionNameAsString();
      String regionName = region.getName();
      if (hriRegionName.equals(regionName)) {
        found = true;
        byte[] startKey = hri.getStartKey();
        byte[] endKey = hri.getEndKey();
        ServerName serverName = e.getServerName();
        InetSocketAddress sa =
            new InetSocketAddress(serverName.getHostname(), serverName.getPort());
        String location = sa.getHostName() + ":" +
          Integer.valueOf(sa.getPort());
        assertEquals(hri.getRegionId(), region.getId());
        assertTrue(Bytes.equals(startKey, region.getStartKey()));
        assertTrue(Bytes.equals(endKey, region.getEndKey()));
        assertEquals(location, region.getLocation());
        break;
      }
    }
    assertTrue(found);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:31,代码来源:TestTableResource.java

示例5: RegionMovedException

import org.apache.hadoop.hbase.ServerName; //导入方法依赖的package包/类
public RegionMovedException(ServerName serverName, long locationSeqNum) {
  this.hostname = serverName.getHostname();
  this.port = serverName.getPort();
  this.startCode = serverName.getStartcode();
  this.locationSeqNum = locationSeqNum;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:7,代码来源:RegionMovedException.java


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